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 state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['F', 'B']\n race text, -- example: ['X', 'A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Oakwood University', 'Alabama A&M University', 'University of Alabama at Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n control text, -- example: ['Public', 'Private not-for-profit']\n student_count integer, -- example: [4051, 11502]\n awards_per_state_value real, -- example: [18.8, 17.8]\n aid_percentile integer, -- example: [72, 50]\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['F', 'B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\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'; graduates refers to grad_cohort; Oakwood University refers to chronname = 'Oakwood University'; in 2013 refers to year = 2013; all sutdents refer to rae = 'X';\nWhat is the number of female graduate for all students cohort from Oakwood University in 2013?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(*) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T1.unitid = T2.unitid WHERE T2.year = 2013 AND T2.gender = 'F' AND T2.race = 'X' AND T1.chronname = 'Oakwood University'", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT COUNT(*) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T1.unitid = T2.unitid WHERE T2.year = 2013 AND T2.gender = 'F' AND T2.race = 'X' AND T1.chronname = 'Oakwood University'", "index": 1800, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['F', 'B']\n race text, -- example: ['X', 'A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Oakwood University', 'Alabama A&M University', 'University of Alabama at Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n control text, -- example: ['Public', 'Private not-for-profit']\n student_count integer, -- example: [4051, 11502]\n awards_per_state_value real, -- example: [18.8, 17.8]\n aid_percentile integer, -- example: [72, 50]\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['F', 'B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\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'; graduates refers to grad_cohort; Oakwood University refers to chronname = 'Oakwood University'; in 2013 refers to year = 2013; all sutdents refer to rae = 'X';\nWhat is the number of female graduate for all students cohort from Oakwood University in 2013?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['X', 'A', 'Ai']\n cohort text, -- example: ['4y other', '4y bach']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Auburn University', 'Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Auburn University', 'University', 'Auburn', 'Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['NULL', 'X']\n flagship text, -- example: ['NULL', 'X']\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['NULL', '823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['NULL', '0', '84']\n aid_value integer, -- example: [7142, 6088]\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['NULL', '36.5', '34.2']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['4y other', '4y bach', '2y all']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngraduate cohort for Auburn University refers to grad_cohort is not null WHERE chronname = 'Auburn University', gender = 'B', race = 'X' and cohort = '4y other', '4y bach'; from 2011 to 2013 refers to year in (2011, 2012, 2013);\nCompare the graduate cohort for Auburn University from 2011 to 2013?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(CASE WHEN T2.year = 2011 THEN T2.grad_cohort ELSE 0 END), SUM(CASE WHEN T2.year = 2012 THEN T2.grad_cohort ELSE 0 END), SUM(CASE WHEN T2.year = 2013 THEN T2.grad_cohort ELSE 0 END) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T1.unitid = T2.unitid WHERE T2.gender = 'B' AND T2.race = 'X' AND T1.chronname = 'Auburn University'", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT SUM(CASE WHEN T2.year = 2011 THEN T2.grad_cohort ELSE 0 END), SUM(CASE WHEN T2.year = 2012 THEN T2.grad_cohort ELSE 0 END), SUM(CASE WHEN T2.year = 2013 THEN T2.grad_cohort ELSE 0 END) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T1.unitid = T2.unitid WHERE T2.gender = 'B' AND T2.race = 'X' AND T1.chronname = 'Auburn University'", "index": 1801, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['X', 'A', 'Ai']\n cohort text, -- example: ['4y other', '4y bach']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Auburn University', 'Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Auburn University', 'University', 'Auburn', 'Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['NULL', 'X']\n flagship text, -- example: ['NULL', 'X']\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['NULL', '823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['NULL', '0', '84']\n aid_value integer, -- example: [7142, 6088]\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['NULL', '36.5', '34.2']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['4y other', '4y bach', '2y all']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngraduate cohort for Auburn University refers to grad_cohort is not null WHERE chronname = 'Auburn University', gender = 'B', race = 'X' and cohort = '4y other', '4y bach'; from 2011 to 2013 refers to year in (2011, 2012, 2013);\nCompare the graduate cohort for Auburn University from 2011 to 2013?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['B', 'X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Private for-profit', 'Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_percentile integer, -- example: [90, 97]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n retain_value real, -- example: [63.1, 80.2]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n carnegie_ct integer, -- example: [386, 106]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['B', 'A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBlack students refers to race = 'B'; private for profit refers to control = 'Private for-profit'; percentage = MULTIPLY(DIVIDE(SUM(race = 'B'), SUM(grad_cohort)), 100.0);\nCalculate the percentage of Black students in all private for profit institutions.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(CASE WHEN T2.race = 'B' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(T2.grad_cohort) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T1.unitid = T2.unitid WHERE T2.race = 'B' AND T1.control = 'Private for-profit'", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T2.race = 'B' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(T2.grad_cohort) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T1.unitid = T2.unitid WHERE T2.race = 'B' AND T1.control = 'Private for-profit'", "index": 1802, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['B', 'X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Private for-profit', 'Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_percentile integer, -- example: [90, 97]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n retain_value real, -- example: [63.1, 80.2]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n carnegie_ct integer, -- example: [386, 106]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['B', 'A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBlack students refers to race = 'B'; private for profit refers to control = 'Private for-profit'; percentage = MULTIPLY(DIVIDE(SUM(race = 'B'), SUM(grad_cohort)), 100.0);\nCalculate the percentage of Black students in all private for profit institutions.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Harvard University', 'Alabama A&M University', 'University of Alabama at Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n lat_y real, -- example: [34.783368, 33.50223]\n student_count integer, -- example: [4051, 11502]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n retain_value real, -- example: [63.1, 80.2]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['F', 'M', 'B']\n race text, -- example: ['A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['F', 'M', 'B']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nratio = MULTIPLY(DIVIDE(SUM(grad_cohort WHERE Gender = 'M'), SUM( grad_cohort WHERE Gender = 'F')), 1.0); Asian refers to race = 'A'; female refers to gender = 'F'; graduates refers to grad_cohort; male refers to gender = 'M'; Harvard University refers to chronname = 'Harvard University'; in 2013 refers to year = 2013;\nWhat is the ratio of Asian male graduates to Asian female graduates from Harvard University in 2013?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(CASE WHEN T2.Gender = 'M' THEN T2.grad_cohort ELSE 0 END) AS REAL) / SUM(CASE WHEN T2.Gender = 'F' THEN T2.grad_cohort ELSE 0 END) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T1.unitid = T2.unitid WHERE T1.chronname = 'Harvard University' AND T2.year = 2013 AND T2.race = 'A'", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T2.Gender = 'M' THEN T2.grad_cohort ELSE 0 END) AS REAL) / SUM(CASE WHEN T2.Gender = 'F' THEN T2.grad_cohort ELSE 0 END) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T1.unitid = T2.unitid WHERE T1.chronname = 'Harvard University' AND T2.year = 2013 AND T2.race = 'A'", "index": 1803, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Harvard University', 'Alabama A&M University', 'University of Alabama at Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n lat_y real, -- example: [34.783368, 33.50223]\n student_count integer, -- example: [4051, 11502]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n retain_value real, -- example: [63.1, 80.2]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['F', 'M', 'B']\n race text, -- example: ['A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['F', 'M', 'B']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nratio = MULTIPLY(DIVIDE(SUM(grad_cohort WHERE Gender = 'M'), SUM( grad_cohort WHERE Gender = 'F')), 1.0); Asian refers to race = 'A'; female refers to gender = 'F'; graduates refers to grad_cohort; male refers to gender = 'M'; Harvard University refers to chronname = 'Harvard University'; in 2013 refers to year = 2013;\nWhat is the ratio of Asian male graduates to Asian female graduates from Harvard University in 2013?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['M', 'B', 'F']\n race text, -- example: ['H', 'A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Amridge University', 'Alabama A&M University', 'University of Alabama at Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n pell_value real, -- example: [71.2, 35.1]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['M', 'B']\n race text, -- example: ['H', 'X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHispanic refers to race = 'H'; male refers to gender = 'M'; Amridge University refers to chronname = 'Amridge University';\nIn total, how many Hispanic male students graduated from Amridge University?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.grad_cohort) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T1.unitid = T2.unitid WHERE T1.chronname = 'Amridge University' AND T2.gender = 'M' AND T2.race = 'H'", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT SUM(T2.grad_cohort) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T1.unitid = T2.unitid WHERE T1.chronname = 'Amridge University' AND T2.gender = 'M' AND T2.race = 'H'", "index": 1804, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['M', 'B', 'F']\n race text, -- example: ['H', 'A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Amridge University', 'Alabama A&M University', 'University of Alabama at Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n pell_value real, -- example: [71.2, 35.1]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['M', 'B']\n race text, -- example: ['H', 'X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHispanic refers to race = 'H'; male refers to gender = 'M'; Amridge University refers to chronname = 'Amridge University';\nIn total, how many Hispanic male students graduated from Amridge University?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['Alabama', 'United States']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n state_appr_rank text, -- example: ['NULL', '11']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Central Alabama Community College', 'Alabama A&M University', 'University of Alabama at Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_state_value real, -- example: [18.8, 17.8]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_percentile integer, -- example: [90, 97]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n aid_value integer, -- example: [7142, 6088]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_percentile integer, -- example: [98, 39]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n carnegie_ct integer, -- example: [386, 106]\n nicknames text, -- example: ['NULL', 'UAB']\n PRIMARY KEY (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCentral Alabama Community College refers to chronname = 'Central Alabama Community College'; in 2011 refers to year = 2011;\nHow many students graduated from Central Alabama Community College in 2011 in total?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.grad_cohort FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T1.unitid = T2.unitid WHERE T1.chronname = 'Central Alabama Community College' AND T2.year = 2011", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT T2.grad_cohort FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T1.unitid = T2.unitid WHERE T1.chronname = 'Central Alabama Community College' AND T2.year = 2011", "index": 1805, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['Alabama', 'United States']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n state_appr_rank text, -- example: ['NULL', '11']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Central Alabama Community College', 'Alabama A&M University', 'University of Alabama at Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_state_value real, -- example: [18.8, 17.8]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_percentile integer, -- example: [90, 97]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n aid_value integer, -- example: [7142, 6088]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_percentile integer, -- example: [98, 39]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n carnegie_ct integer, -- example: [386, 106]\n nicknames text, -- example: ['NULL', 'UAB']\n PRIMARY KEY (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCentral Alabama Community College refers to chronname = 'Central Alabama Community College'; in 2011 refers to year = 2011;\nHow many students graduated from Central Alabama Community College in 2011 in total?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['Alabama', 'United States']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Central Alabama Community College', 'Alabama A&M University', 'University of Alabama at Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n aid_value integer, -- example: [7142, 6088]\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_value real, -- example: [71.2, 35.1]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n nicknames text, -- example: ['NULL', 'UAB']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['M', 'F', 'B']\n race text, -- example: ['W', 'A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['M', 'F', 'B']\n race text, -- example: ['W', 'X']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\namount of percentage = SUM(grad_150 WHERE gender = 'F') as female; percentage = SUM(grad_150 WHERE gender = 'M') as male; Central Alabama Community College refers to chronname = 'Central Alabama Community College'; in 2011 refers to year = 2011; graduated within 150 percent of normal/expected time refers to grad_150; female refers to gender = 'F'; White refers to race = 'w'; male refers to gender = 'M';\nWhich cohort had the higher percentage of students who graduated from Central Alabama Community College in 2011 within 150 percent of normal/expected time, female White students or male White students?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT IIF(SUM(CASE WHEN T2.gender = 'F' THEN T2.grad_150 ELSE 0 END) > SUM(CASE WHEN T2.gender = 'M' THEN T2.grad_150 ELSE 0 END), 'female White students', 'male White students') FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.chronname = 'Central Alabama Community College' AND T2.year = 2011 AND T2.race = 'W'", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT IIF(SUM(CASE WHEN T2.gender = 'F' THEN T2.grad_150 ELSE 0 END) > SUM(CASE WHEN T2.gender = 'M' THEN T2.grad_150 ELSE 0 END), 'female White students', 'male White students') FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.chronname = 'Central Alabama Community College' AND T2.year = 2011 AND T2.race = 'W'", "index": 1806, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['Alabama', 'United States']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Central Alabama Community College', 'Alabama A&M University', 'University of Alabama at Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n aid_value integer, -- example: [7142, 6088]\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_value real, -- example: [71.2, 35.1]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n nicknames text, -- example: ['NULL', 'UAB']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['M', 'F', 'B']\n race text, -- example: ['W', 'A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['M', 'F', 'B']\n race text, -- example: ['W', 'X']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\namount of percentage = SUM(grad_150 WHERE gender = 'F') as female; percentage = SUM(grad_150 WHERE gender = 'M') as male; Central Alabama Community College refers to chronname = 'Central Alabama Community College'; in 2011 refers to year = 2011; graduated within 150 percent of normal/expected time refers to grad_150; female refers to gender = 'F'; White refers to race = 'w'; male refers to gender = 'M';\nWhich cohort had the higher percentage of students who graduated from Central Alabama Community College in 2011 within 150 percent of normal/expected time, female White students or male White students?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['M', 'B', 'F']\n race text, -- example: ['W', 'A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Institute', 'Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_value real, -- example: [71.2, 35.1]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n nicknames text, -- example: ['NULL', 'UAB']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['M', 'B']\n race text, -- example: ['W', 'X']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale refers to gender = 'M'; white refers to race = 'w'; in 2011 refers to year = 2011; graduating within 150 percent of normal/expected time refers to grad_150;\nWhich institute has the highest percentage of male White students graduating in 2011 within 150 percent of normal/expected time?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.chronname FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T2.year = 2011 AND T2.gender = 'M' AND T2.race = 'W' AND T2.grad_150 = ( SELECT MAX(T2.grad_150) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T2.year = 2011 AND T2.gender = 'M' AND T2.race = 'W' )", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT T1.chronname FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T2.year = 2011 AND T2.gender = 'M' AND T2.race = 'W' AND T2.grad_150 = ( SELECT MAX(T2.grad_150) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T2.year = 2011 AND T2.gender = 'M' AND T2.race = 'W' )", "index": 1807, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['M', 'B', 'F']\n race text, -- example: ['W', 'A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Institute', 'Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_value real, -- example: [71.2, 35.1]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n nicknames text, -- example: ['NULL', 'UAB']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['M', 'B']\n race text, -- example: ['W', 'X']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale refers to gender = 'M'; white refers to race = 'w'; in 2011 refers to year = 2011; graduating within 150 percent of normal/expected time refers to grad_150;\nWhich institute has the highest percentage of male White students graduating in 2011 within 150 percent of normal/expected time?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n cohort text, -- example: ['2y all', '4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['B', 'X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['Alabama', 'United States']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n awards_per_state_value text, -- example: ['NULL', '18.8']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n grad_rate_rank text, -- example: ['23', '18']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['2-year', '4-year']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n endow_value text, -- example: ['NULL', '24136']\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_percentile integer, -- example: [98, 39]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n PRIMARY KEY (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n2-year institute refers to cohort = '2y all'; Alabama refers to state = 'Alabama'; in 2011 refers to year = 2011; T2.gender = 'B' means both genders;\nHow many students for both genders graduated from a 2-year institute in Alabama in 2011?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(T2.grad_cohort) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T2.cohort = '2y all' AND T2.year = 2011 AND T1.state = 'Alabama'", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT SUM(T2.grad_cohort) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T2.cohort = '2y all' AND T2.year = 2011 AND T1.state = 'Alabama'", "index": 1808, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n cohort text, -- example: ['2y all', '4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['B', 'X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['Alabama', 'United States']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n awards_per_state_value text, -- example: ['NULL', '18.8']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n grad_rate_rank text, -- example: ['23', '18']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['2-year', '4-year']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n endow_value text, -- example: ['NULL', '24136']\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_percentile integer, -- example: [98, 39]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n PRIMARY KEY (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n2-year institute refers to cohort = '2y all'; Alabama refers to state = 'Alabama'; in 2011 refers to year = 2011; T2.gender = 'B' means both genders;\nHow many students for both genders graduated from a 2-year institute in Alabama in 2011?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['Alabama', 'United States']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n city text, -- example: ['Institute', 'Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n lat_y real, -- example: [34.783368, 33.50223]\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n endow_value text, -- example: ['NULL', '24136']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n carnegie_ct integer, -- example: [386, 106]\n nicknames text, -- example: ['NULL', 'UAB']\n PRIMARY KEY (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercent rank for median SAT value within sector refers to med_sat_percentile; over 500 graduates refers to grad_cohort > 500; in 2011 refers to year = 2011;\nAmong the institutes in the state of Alabama whose percent rank for median SAT value within sector is 77, how many of them have over 500 graduates in total in 2011?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(DISTINCT T1.chronname) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.state = 'Alabama' AND T1.med_sat_percentile = '100' AND T2.year = 2011 AND T2.grad_cohort > 500", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T1.chronname) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.state = 'Alabama' AND T1.med_sat_percentile = '100' AND T2.year = 2011 AND T2.grad_cohort > 500", "index": 1809, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['Alabama', 'United States']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n city text, -- example: ['Institute', 'Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n lat_y real, -- example: [34.783368, 33.50223]\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n endow_value text, -- example: ['NULL', '24136']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n carnegie_ct integer, -- example: [386, 106]\n nicknames text, -- example: ['NULL', 'UAB']\n PRIMARY KEY (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercent rank for median SAT value within sector refers to med_sat_percentile; over 500 graduates refers to grad_cohort > 500; in 2011 refers to year = 2011;\nAmong the institutes in the state of Alabama whose percent rank for median SAT value within sector is 77, how many of them have over 500 graduates in total in 2011?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['Alabama', 'United States']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n state text, -- example: ['Alabama', 'Alaska']\n control text, -- example: ['Public', 'Private not-for-profit']\n flagship text, -- example: ['NULL', 'X']\n endow_percentile text, -- example: ['NULL', '93']\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n `year` integer, -- example: [2011, 2012]\n grad_100 text, -- graduation 100, example: ['0', '2']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npublic refers to control = 'Public'; over 30 students who graduated within 100 percent of normal/expected time refers to grad_100 > 30; in 2011 refers to year = 2011;\nAmong the public institutes in the state of Alabama, how many of them have over 30 students who graduated within 100 percent of normal/expected time in 2011?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T1.chronname) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.state = 'Alabama' AND T1.control = 'Public' AND T2.year = 2011 AND T2.grad_100 > 30", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT COUNT(T1.chronname) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.state = 'Alabama' AND T1.control = 'Public' AND T2.year = 2011 AND T2.grad_100 > 30", "index": 1810, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['Alabama', 'United States']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n state text, -- example: ['Alabama', 'Alaska']\n control text, -- example: ['Public', 'Private not-for-profit']\n flagship text, -- example: ['NULL', 'X']\n endow_percentile text, -- example: ['NULL', '93']\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n `year` integer, -- example: [2011, 2012]\n grad_100 text, -- graduation 100, example: ['0', '2']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npublic refers to control = 'Public'; over 30 students who graduated within 100 percent of normal/expected time refers to grad_100 > 30; in 2011 refers to year = 2011;\nAmong the public institutes in the state of Alabama, how many of them have over 30 students who graduated within 100 percent of normal/expected time in 2011?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['Alabama', 'United States']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Institute', 'Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n flagship text, -- example: ['X', 'NULL']\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n race text, -- example: ['X', 'A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of the institutes refers to chronname; graduates refers to grad_cohort; grad_cohort > 500; in 2011 refers to year = 2011; all students refer to race = 'X'.\nPlease list the names of the institutes in the state of Alabama whose all graduates in total exceeded 500 in 2011?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT T1.chronname FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.state = 'Alabama' AND T2.year = 2011 AND T2.race = 'X' AND T2.grad_cohort > 500", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT DISTINCT T1.chronname FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.state = 'Alabama' AND T2.year = 2011 AND T2.race = 'X' AND T2.grad_cohort > 500", "index": 1811, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['Alabama', 'United States']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Institute', 'Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n flagship text, -- example: ['X', 'NULL']\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n race text, -- example: ['X', 'A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of the institutes refers to chronname; graduates refers to grad_cohort; grad_cohort > 500; in 2011 refers to year = 2011; all students refer to race = 'X'.\nPlease list the names of the institutes in the state of Alabama whose all graduates in total exceeded 500 in 2011?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Swarthmore College', 'Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Swarthmore', 'Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_percentile integer, -- example: [98, 39]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwebsite address refers to site; Swarthmore College refers to chronname = 'Swarthmore College';\nGive the web site address for \"Swarthmore College\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 FROM ( SELECT DISTINCT CASE WHEN chronname = 'Swarthmore College' THEN site ELSE NULL END AS T FROM institution_details ) WHERE T IS NOT NULL", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT T FROM ( SELECT DISTINCT CASE WHEN chronname = 'Swarthmore College' THEN site ELSE NULL END AS T FROM institution_details ) WHERE T IS NOT NULL", "index": 1812, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Swarthmore College', 'Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Swarthmore', 'Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_percentile integer, -- example: [98, 39]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwebsite address refers to site; Swarthmore College refers to chronname = 'Swarthmore College';\nGive the web site address for \"Swarthmore College\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n grad_150 text, -- graduation 150, example: ['0', '3']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Mercer University', 'Alabama A&M University', 'University of Alabama at Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n fte_percentile integer, -- example: [33, 67]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_value real, -- example: [71.2, 35.1]\n pell_percentile integer, -- example: [98, 39]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n nicknames text, -- example: ['NULL', 'UAB']\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMercer University refers to chronname = 'Mercer University';\nWhich state is \"Mercer University\" located in?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T FROM ( SELECT DISTINCT CASE WHEN chronname = 'Mercer University' THEN state ELSE NULL END AS T FROM institution_details ) WHERE T IS NOT NULL", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT T FROM ( SELECT DISTINCT CASE WHEN chronname = 'Mercer University' THEN state ELSE NULL END AS T FROM institution_details ) WHERE T IS NOT NULL", "index": 1813, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n grad_150 text, -- graduation 150, example: ['0', '3']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Mercer University', 'Alabama A&M University', 'University of Alabama at Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n fte_percentile integer, -- example: [33, 67]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_value real, -- example: [71.2, 35.1]\n pell_percentile integer, -- example: [98, 39]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n nicknames text, -- example: ['NULL', 'UAB']\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMercer University refers to chronname = 'Mercer University';\nWhich state is \"Mercer University\" located in?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n gender text, -- example: ['B', 'F']\n race text, -- example: ['A', 'Ai']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n grad_rate_rank text, -- example: ['23', '18']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Rensselaer Polytechnic Institute', 'Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Rensselaer', 'Institute', 'Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n control text, -- example: ['Public', 'Private not-for-profit']\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n aid_value integer, -- example: [7142, 6088]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_percentile integer, -- example: [98, 39]\n retain_percentile integer, -- example: [17, 70]\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n race text, -- example: ['X', 'W']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRensselaer Polytechnic Institute refers to chronname = 'Rensselaer Polytechnic Institute';\nWhich city is \"Rensselaer Polytechnic Institute\" located in?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T FROM ( SELECT DISTINCT CASE WHEN chronname = 'Rensselaer Polytechnic Institute' THEN city ELSE NULL END AS T FROM institution_details ) WHERE T IS NOT NULL", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT T FROM ( SELECT DISTINCT CASE WHEN chronname = 'Rensselaer Polytechnic Institute' THEN city ELSE NULL END AS T FROM institution_details ) WHERE T IS NOT NULL", "index": 1814, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n gender text, -- example: ['B', 'F']\n race text, -- example: ['A', 'Ai']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n grad_rate_rank text, -- example: ['23', '18']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Rensselaer Polytechnic Institute', 'Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Rensselaer', 'Institute', 'Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n control text, -- example: ['Public', 'Private not-for-profit']\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n aid_value integer, -- example: [7142, 6088]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_percentile integer, -- example: [98, 39]\n retain_percentile integer, -- example: [17, 70]\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n race text, -- example: ['X', 'W']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRensselaer Polytechnic Institute refers to chronname = 'Rensselaer Polytechnic Institute';\nWhich city is \"Rensselaer Polytechnic Institute\" located in?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n race text, -- example: ['X', 'W']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['Delaware', 'United States', 'Alabama']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n state_appr_rank text, -- example: ['NULL', '11']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n state text, -- example: ['Delaware', 'Alabama', 'Alaska']\n aid_percentile integer, -- example: [72, 50]\n pell_percentile integer, -- example: [98, 39]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Delaware', 'Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n race text, -- example: ['A', 'Ai']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nabbreviation for state refers to state_abbr;\nTell the abbreviation for \"Delaware\" 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 T FROM ( SELECT DISTINCT CASE WHEN state = 'Delaware' THEN state_abbr ELSE NULL END AS T FROM state_sector_grads ) WHERE T IS NOT NULL", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT T FROM ( SELECT DISTINCT CASE WHEN state = 'Delaware' THEN state_abbr ELSE NULL END AS T FROM state_sector_grads ) WHERE T IS NOT NULL", "index": 1815, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n race text, -- example: ['X', 'W']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['Delaware', 'United States', 'Alabama']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n state_appr_rank text, -- example: ['NULL', '11']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n state text, -- example: ['Delaware', 'Alabama', 'Alaska']\n aid_percentile integer, -- example: [72, 50]\n pell_percentile integer, -- example: [98, 39]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Delaware', 'Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n race text, -- example: ['A', 'Ai']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nabbreviation for state refers to state_abbr;\nTell the abbreviation for \"Delaware\" 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 institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n state text, -- example: ['California', 'Alabama', 'Alaska']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n state_sector_ct integer, -- example: [13, 16]\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['California', 'Alabama', 'Alaska']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n level text, -- example: ['2-year', '4-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n cohort text, -- example: ['4y bach', '4y other']\n grad_150_rate text, -- example: ['NULL', '0']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['California', 'United States', 'Alabama']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n state_appr_rank text, -- example: ['NULL', '11']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n2-year refers to level = '2-year'; public refers to control = 'public'; California refers to state = 'California';\nHow many 2-year public schools are there in \"California\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(stateid) FROM state_sector_details WHERE state = 'California' AND level = '2-year' AND control = 'Public'", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT COUNT(stateid) FROM state_sector_details WHERE state = 'California' AND level = '2-year' AND control = 'Public'", "index": 1816, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n state text, -- example: ['California', 'Alabama', 'Alaska']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n state_sector_ct integer, -- example: [13, 16]\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['California', 'Alabama', 'Alaska']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n level text, -- example: ['2-year', '4-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n cohort text, -- example: ['4y bach', '4y other']\n grad_150_rate text, -- example: ['NULL', '0']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['California', 'United States', 'Alabama']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n state_appr_rank text, -- example: ['NULL', '11']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n2-year refers to level = '2-year'; public refers to control = 'public'; California refers to state = 'California';\nHow many 2-year public schools are there in \"California\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Idaho', 'Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n state text, -- example: ['Idaho', 'Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_percentile integer, -- example: [90, 97]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n carnegie_ct integer, -- example: [386, 106]\n nicknames text, -- example: ['NULL', 'UAB']\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n gender text, -- example: ['B', 'M']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['Idaho', 'United States', 'Alabama']\n state_post text, -- example: ['Idaho', 'U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npost name refers to state_post;\nGive the post name of \"Idaho\" 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 T FROM ( SELECT DISTINCT CASE WHEN state = 'Idaho' THEN state_post ELSE NULL END AS T FROM state_sector_details ) WHERE T IS NOT NULL", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT T FROM ( SELECT DISTINCT CASE WHEN state = 'Idaho' THEN state_post ELSE NULL END AS T FROM state_sector_details ) WHERE T IS NOT NULL", "index": 1817, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Idaho', 'Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n state text, -- example: ['Idaho', 'Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_percentile integer, -- example: [90, 97]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n carnegie_ct integer, -- example: [386, 106]\n nicknames text, -- example: ['NULL', 'UAB']\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n gender text, -- example: ['B', 'M']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['Idaho', 'United States', 'Alabama']\n state_post text, -- example: ['Idaho', 'U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npost name refers to state_post;\nGive the post name of \"Idaho\" 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 institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n aid_value integer, -- example: [7142, 6088]\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n nicknames text, -- example: ['NULL', 'UAB']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['NJ', 'AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n race text, -- example: ['A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_150_rate text, -- example: ['NULL', '0']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\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 school refers to chronname; NJ refers to state_abbr = 'NJ'; bachelor's degree refers to level = '4-year'; highest students number refers to MAX(student_count);\nTell the name of school in \"NJ\" that could get the bachelor's degree with highest students number.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT T1.chronname FROM institution_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.state = T1.state WHERE T2.state_abbr = 'NJ' AND T1.level = '4-year' AND T1.student_count = ( SELECT MAX(T1.student_count) FROM institution_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.state = T1.state WHERE T2.state_abbr = 'NJ' AND T1.level = '4-year' )", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT DISTINCT T1.chronname FROM institution_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.state = T1.state WHERE T2.state_abbr = 'NJ' AND T1.level = '4-year' AND T1.student_count = ( SELECT MAX(T1.student_count) FROM institution_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.state = T1.state WHERE T2.state_abbr = 'NJ' AND T1.level = '4-year' )", "index": 1818, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n aid_value integer, -- example: [7142, 6088]\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n nicknames text, -- example: ['NULL', 'UAB']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['NJ', 'AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n race text, -- example: ['A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_150_rate text, -- example: ['NULL', '0']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\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 school refers to chronname; NJ refers to state_abbr = 'NJ'; bachelor's degree refers to level = '4-year'; highest students number refers to MAX(student_count);\nTell the name of school in \"NJ\" that could get the bachelor's degree with highest students number.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n pell_percentile integer, -- example: [98, 39]\n retain_percentile integer, -- example: [17, 70]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n state_sector_ct integer, -- example: [13, 16]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['PA', 'AL', 'AK']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['A', 'Ai']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nweb site address refers to site; PA refers to state_abbr = 'PA'; highest latitude refers to MAX(lat_y);\nGive the web site address for the school in \"PA\" state with the highest latitude.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.site FROM institution_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.state = T1.state WHERE T2.state_abbr = 'PA' AND T1.lat_y = ( SELECT MAX(T1.lat_y) FROM institution_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.state = T1.state WHERE T2.state_abbr = 'PA' )", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT DISTINCT T1.site FROM institution_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.state = T1.state WHERE T2.state_abbr = 'PA' AND T1.lat_y = ( SELECT MAX(T1.lat_y) FROM institution_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.state = T1.state WHERE T2.state_abbr = 'PA' )", "index": 1819, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n pell_percentile integer, -- example: [98, 39]\n retain_percentile integer, -- example: [17, 70]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n state_sector_ct integer, -- example: [13, 16]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['PA', 'AL', 'AK']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['A', 'Ai']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nweb site address refers to site; PA refers to state_abbr = 'PA'; highest latitude refers to MAX(lat_y);\nGive the web site address for the school in \"PA\" state with the highest latitude.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n city text, -- example: ['Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n long_x real, -- example: [-86.568502, -86.80917]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n aid_value integer, -- example: [7142, 6088]\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n nicknames text, -- example: ['NULL', 'UAB']\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n awards_per_state_value text, -- example: ['NULL', '18.8']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['UT', 'AL', 'AK']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['A', 'Ai']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n4-year refers to level = '4-year'; public refers to control = 'Public'; UT refers to state_abbr = 'UT'; graduation rate exceeds the average for the state refers to awards_per_value > awards_per_state_value;\nTell the number of 4-year public schools in UT whose graduation rate exceeds the average for 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 COUNT(DISTINCT T1.chronname) FROM institution_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.state = T1.state WHERE T2.state_abbr = 'UT' AND T1.level = '4-year' AND T1.control = 'Public' AND T1.awards_per_value > T1.awards_per_state_value", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T1.chronname) FROM institution_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.state = T1.state WHERE T2.state_abbr = 'UT' AND T1.level = '4-year' AND T1.control = 'Public' AND T1.awards_per_value > T1.awards_per_state_value", "index": 1820, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n city text, -- example: ['Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n long_x real, -- example: [-86.568502, -86.80917]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n aid_value integer, -- example: [7142, 6088]\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n nicknames text, -- example: ['NULL', 'UAB']\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n awards_per_state_value text, -- example: ['NULL', '18.8']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['UT', 'AL', 'AK']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['A', 'Ai']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n4-year refers to level = '4-year'; public refers to control = 'Public'; UT refers to state_abbr = 'UT'; graduation rate exceeds the average for the state refers to awards_per_value > awards_per_state_value;\nTell the number of 4-year public schools in UT whose graduation rate exceeds the average for 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 institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n aid_percentile integer, -- example: [72, 50]\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_percentile integer, -- example: [98, 39]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n nicknames text, -- example: ['NULL', 'UAB']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['ID', 'AL', 'AK']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\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 school refers to chronname; 4-year refers to level = '4-year'; public refers to control = 'Public'; ID refers to state_abbr = 'ID'; lowest graduation 100 value refers to MIN(grad_100_value);\nGive the name of the 4-year public school in \"ID\" with the lowest graduation 100 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 T1.chronname FROM institution_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.state = T1.state WHERE T2.state_abbr = 'ID' AND T1.level = '4-year' AND T1.control = 'Public' GROUP BY T1.chronname ORDER BY SUM(T1.grad_100_value) ASC LIMIT 1", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT T1.chronname FROM institution_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.state = T1.state WHERE T2.state_abbr = 'ID' AND T1.level = '4-year' AND T1.control = 'Public' GROUP BY T1.chronname ORDER BY SUM(T1.grad_100_value) ASC LIMIT 1", "index": 1821, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n aid_percentile integer, -- example: [72, 50]\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_percentile integer, -- example: [98, 39]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n nicknames text, -- example: ['NULL', 'UAB']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['ID', 'AL', 'AK']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\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 school refers to chronname; 4-year refers to level = '4-year'; public refers to control = 'Public'; ID refers to state_abbr = 'ID'; lowest graduation 100 value refers to MIN(grad_100_value);\nGive the name of the 4-year public school in \"ID\" with the lowest graduation 100 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 state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Private not-for-profit', 'Private for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private not-for-profit', 'Private for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n race text, -- example: ['A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Brevard Community College', 'Howard Community College', 'Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Brevard', 'Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Private not-for-profit', 'Public']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_value real, -- example: [71.2, 35.1]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n state_sector_ct integer, -- example: [13, 16]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n nicknames text, -- example: ['NULL', 'UAB']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n4-year refers to level = '4-year'; private not-for-profit refers to control = 'Private not-for-profit'; Brevard Community College refers to chronname = 'Brevard Community College';\nTell the number of 4-year private not-for-profit schools in the home state of \"Brevard Community College\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.chronname) FROM institution_details AS T1 INNER JOIN state_sector_details AS T2 ON T2.state = T1.state WHERE T2.level = '4-year' AND T2.control = 'Private not-for-profit' AND T1.chronname = 'Brevard Community College'", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT COUNT(T1.chronname) FROM institution_details AS T1 INNER JOIN state_sector_details AS T2 ON T2.state = T1.state WHERE T2.level = '4-year' AND T2.control = 'Private not-for-profit' AND T1.chronname = 'Brevard Community College'", "index": 1822, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Private not-for-profit', 'Private for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private not-for-profit', 'Private for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n race text, -- example: ['A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Brevard Community College', 'Howard Community College', 'Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Brevard', 'Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Private not-for-profit', 'Public']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_value real, -- example: [71.2, 35.1]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n state_sector_ct integer, -- example: [13, 16]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n nicknames text, -- example: ['NULL', 'UAB']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n4-year refers to level = '4-year'; private not-for-profit refers to control = 'Private not-for-profit'; Brevard Community College refers to chronname = 'Brevard Community College';\nTell the number of 4-year private not-for-profit schools in the home state of \"Brevard Community College\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n pell_percentile integer, -- example: [98, 39]\n retain_percentile integer, -- example: [17, 70]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n nicknames text, -- example: ['NULL', 'UAB']\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n level text, -- example: ['2-year', '4-year']\n `year` integer, -- example: [2011, 2012]\n race text, -- example: ['X', 'A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['Alabama', 'United States']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\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 graduated students refers to grad_cohort; 2-year refers to level = '2-year'; public refers to control = 'Public'; Alabama refers to state = 'Alabama'; in 2011 refers to year = '2011'; reace = 'X' means all students.\nGive the total number of all graduated students from a 2-year public schools in Alabama in 2011.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(T2.grad_cohort) FROM state_sector_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.stateid = T1.stateid WHERE T1.state = 'Alabama' AND T2.year = 2011 AND T1.level = '2-year' AND T1.control = 'Public' AND T2.race = 'X'", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT SUM(T2.grad_cohort) FROM state_sector_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.stateid = T1.stateid WHERE T1.state = 'Alabama' AND T2.year = 2011 AND T1.level = '2-year' AND T1.control = 'Public' AND T2.race = 'X'", "index": 1823, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n pell_percentile integer, -- example: [98, 39]\n retain_percentile integer, -- example: [17, 70]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n nicknames text, -- example: ['NULL', 'UAB']\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n level text, -- example: ['2-year', '4-year']\n `year` integer, -- example: [2011, 2012]\n race text, -- example: ['X', 'A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['Alabama', 'United States']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\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 graduated students refers to grad_cohort; 2-year refers to level = '2-year'; public refers to control = 'Public'; Alabama refers to state = 'Alabama'; in 2011 refers to year = '2011'; reace = 'X' means all students.\nGive the total number of all graduated students from a 2-year public schools in Alabama in 2011.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['United States', 'Alabama', 'Alaska']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['A', 'Ai']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150_rate text, -- example: ['NULL', '0']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n cohort text, -- example: ['2y all', '4y other']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Madison Area Technical College', 'ITI Technical College', 'Alabama A&M University', 'University of Alabama at Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n flagship text, -- example: ['NULL', 'X']\n student_count integer, -- example: [4051, 11502]\n awards_per_state_value real, -- example: [18.8, 17.8]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n endow_percentile text, -- example: ['NULL', '93']\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n state_sector_ct integer, -- example: [13, 16]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\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(chronname = 'Madison Area Technical College'), SUM(state = 'Alabama')), 100); 4-year refers to level = '4-year'; public refers to control = 'Public'; Madison Area Technical College refers to chronname = 'Madison Area Technical College'; home state in the United States refers to state;\nWhat is the percentage of the number of 4-year public schools from Madison Area Technical College's home state in the Alabama?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(DISTINCT CASE WHEN T1.state = ( SELECT T1.state FROM institution_details AS T1 INNER JOIN state_sector_details AS T2 ON T2.state = T1.state WHERE T1.chronname = 'Madison Area Technical College' ) AND T1.level = '4-year' AND T1.control = 'Public' THEN T1.chronname ELSE NULL END) AS REAL) * 100 / COUNT(DISTINCT CASE WHEN T2.state = 'Alabama' THEN T1.chronname ELSE NULL END) FROM institution_details AS T1 INNER JOIN state_sector_details AS T2 ON T2.state = T1.state", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT CAST(COUNT(DISTINCT CASE WHEN T1.state = ( SELECT T1.state FROM institution_details AS T1 INNER JOIN state_sector_details AS T2 ON T2.state = T1.state WHERE T1.chronname = 'Madison Area Technical College' ) AND T1.level = '4-year' AND T1.control = 'Public' THEN T1.chronname ELSE NULL END) AS REAL) * 100 / COUNT(DISTINCT CASE WHEN T2.state = 'Alabama' THEN T1.chronname ELSE NULL END) FROM institution_details AS T1 INNER JOIN state_sector_details AS T2 ON T2.state = T1.state", "index": 1824, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['United States', 'Alabama', 'Alaska']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['A', 'Ai']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150_rate text, -- example: ['NULL', '0']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n cohort text, -- example: ['2y all', '4y other']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Madison Area Technical College', 'ITI Technical College', 'Alabama A&M University', 'University of Alabama at Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n flagship text, -- example: ['NULL', 'X']\n student_count integer, -- example: [4051, 11502]\n awards_per_state_value real, -- example: [18.8, 17.8]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n endow_percentile text, -- example: ['NULL', '93']\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n state_sector_ct integer, -- example: [13, 16]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\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(chronname = 'Madison Area Technical College'), SUM(state = 'Alabama')), 100); 4-year refers to level = '4-year'; public refers to control = 'Public'; Madison Area Technical College refers to chronname = 'Madison Area Technical College'; home state in the United States refers to state;\nWhat is the percentage of the number of 4-year public schools from Madison Area Technical College's home state in the Alabama?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n awards_per_state_value text, -- example: ['NULL', '18.8']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_value real, -- example: [71.2, 35.1]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n nicknames text, -- example: ['NULL', 'UAB']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2011 refers to year = '2011'; national sector average of 20 and below refers to awards_per_natl_value < 20;\nList down the states in 2011 with a national sector average of 20 and below.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT T1.state FROM state_sector_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.stateid = T1.stateid WHERE T2.year = 2011 AND T1.awards_per_natl_value <= 20", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT DISTINCT T1.state FROM state_sector_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.stateid = T1.stateid WHERE T2.year = 2011 AND T1.awards_per_natl_value <= 20", "index": 1825, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n awards_per_state_value text, -- example: ['NULL', '18.8']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_value real, -- example: [71.2, 35.1]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n nicknames text, -- example: ['NULL', 'UAB']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2011 refers to year = '2011'; national sector average of 20 and below refers to awards_per_natl_value < 20;\nList down the states in 2011 with a national sector average of 20 and below.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n race text, -- example: ['X', 'W']\n grad_150 text, -- graduation 150, example: ['105', '40']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Institute', 'Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_percentile integer, -- example: [90, 97]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_value real, -- example: [71.2, 35.1]\n retain_percentile integer, -- example: [17, 70]\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n carnegie_ct integer, -- example: [386, 106]\n nicknames text, -- example: ['NULL', 'UAB']\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n race text, -- example: ['X', 'A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_150_rate text, -- example: ['NULL', '0']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest number of students refers to student_count; all students refer to race = 'X'.\nAmong the race of all students, what is the control of institution and level of institution with highest number of students?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT T1.control, T1.level FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T2.race = 'X' AND T1.student_count = ( SELECT MAX(T1.student_count) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T2.race = 'X' )", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT DISTINCT T1.control, T1.level FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T2.race = 'X' AND T1.student_count = ( SELECT MAX(T1.student_count) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T2.race = 'X' )", "index": 1826, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n race text, -- example: ['X', 'W']\n grad_150 text, -- graduation 150, example: ['105', '40']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Institute', 'Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_percentile integer, -- example: [90, 97]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_value real, -- example: [71.2, 35.1]\n retain_percentile integer, -- example: [17, 70]\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n carnegie_ct integer, -- example: [386, 106]\n nicknames text, -- example: ['NULL', 'UAB']\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n race text, -- example: ['X', 'A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_150_rate text, -- example: ['NULL', '0']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest number of students refers to student_count; all students refer to race = 'X'.\nAmong the race of all students, what is the control of institution and level of institution with highest number of students?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n PRIMARY KEY (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npublic refers to control = 'Public'; school_count < 20;\nAmong the states with a public school count of 20 and below, list their race.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.race FROM state_sector_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.stateid = T1.stateid WHERE T1.schools_count <= 20 AND T1.control = 'Public'", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT DISTINCT T2.race FROM state_sector_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.stateid = T1.stateid WHERE T1.schools_count <= 20 AND T1.control = 'Public'", "index": 1827, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Public', 'Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n PRIMARY KEY (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npublic refers to control = 'Public'; school_count < 20;\nAmong the states with a public school count of 20 and below, list their race.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_value real, -- example: [71.2, 35.1]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n nicknames text, -- example: ['NULL', 'UAB']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstate that starts with letter A refers to state LIKE 'A%'; national sector average of 16.5 refers to awards_per_natl_value = 16.5; number of degree-seeking students in the cohort refers to grad_cohort; in 2012 refers to year = '2012';\nAmong the states that start with letter A and attained a national sector average of 16.5, give the number of degree-seeking students in the cohort of those students in 2012 .\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(T2.grad_cohort) FROM state_sector_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.stateid = T1.stateid WHERE T2.state LIKE 'A%' AND T1.awards_per_natl_value = 16.5 AND T2.year = 2012", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT SUM(T2.grad_cohort) FROM state_sector_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.stateid = T1.stateid WHERE T2.state LIKE 'A%' AND T1.awards_per_natl_value = 16.5 AND T2.year = 2012", "index": 1828, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_value real, -- example: [71.2, 35.1]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n nicknames text, -- example: ['NULL', 'UAB']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstate that starts with letter A refers to state LIKE 'A%'; national sector average of 16.5 refers to awards_per_natl_value = 16.5; number of degree-seeking students in the cohort refers to grad_cohort; in 2012 refers to year = '2012';\nAmong the states that start with letter A and attained a national sector average of 16.5, give the number of degree-seeking students in the cohort of those students in 2012 .\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Institute', 'Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_value real, -- example: [71.2, 35.1]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n nicknames text, -- example: ['NULL', 'UAB']\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrecent year of data release refers to newest year;\nList the site of institution within the student count of 500 to 1000 that has the recent year of data release.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.site FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.student_count BETWEEN 500 AND 1000 AND T2.year = ( SELECT MAX(T2.year) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid )", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT DISTINCT T1.site FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.student_count BETWEEN 500 AND 1000 AND T2.year = ( SELECT MAX(T2.year) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid )", "index": 1829, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Institute', 'Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_value real, -- example: [71.2, 35.1]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n nicknames text, -- example: ['NULL', 'UAB']\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrecent year of data release refers to newest year;\nList the site of institution within the student count of 500 to 1000 that has the recent year of data release.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['F', 'B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_value real, -- example: [71.2, 35.1]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n nicknames text, -- example: ['NULL', 'UAB']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['F', 'B']\n race text, -- example: ['A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\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'; number of schools refers to schools_count; schools_count BETWEEN 10 AND 20;\nIn female students in year 2012, how many of them from a state with number of schools ranges from 10 to 20?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.race) FROM state_sector_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.stateid = T1.stateid WHERE T2.gender = 'F' AND schools_count BETWEEN 10 AND 20 AND T2.year = 2012", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT COUNT(T2.race) FROM state_sector_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.stateid = T1.stateid WHERE T2.gender = 'F' AND schools_count BETWEEN 10 AND 20 AND T2.year = 2012", "index": 1830, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['F', 'B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_value real, -- example: [71.2, 35.1]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n nicknames text, -- example: ['NULL', 'UAB']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['F', 'B']\n race text, -- example: ['A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\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'; number of schools refers to schools_count; schools_count BETWEEN 10 AND 20;\nIn female students in year 2012, how many of them from a state with number of schools ranges from 10 to 20?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n `year` integer, -- example: [2011, 2012]\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_150_rate text, -- example: ['NULL', '0']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n awards_per_state_value text, -- example: ['NULL', '18.8']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_rank text, -- example: ['NULL', '11']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Harvard University', 'Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['University', 'Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n awards_per_value real, -- example: [14.2, 20.9]\n fte_percentile integer, -- example: [33, 67]\n endow_value text, -- example: ['NULL', '24136']\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n PRIMARY KEY (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHarvard University refers to chronname = 'Harvard University'; highest number of first-time, full-time, degree-seeking students in the cohort being tracked, minus any exclusions refers to MAX(grad_cohort);\nIn Harvard University, which year recorded the highest number of first-time, full-time, degree-seeking students in the cohort being tracked, minus any exclusions?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.year FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.chronname = 'Harvard University' GROUP BY T2.year ORDER BY SUM(T2.grad_cohort) DESC LIMIT 1", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT T2.year FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.chronname = 'Harvard University' GROUP BY T2.year ORDER BY SUM(T2.grad_cohort) DESC LIMIT 1", "index": 1831, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n `year` integer, -- example: [2011, 2012]\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_150_rate text, -- example: ['NULL', '0']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n awards_per_state_value text, -- example: ['NULL', '18.8']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_rank text, -- example: ['NULL', '11']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Harvard University', 'Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['University', 'Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n awards_per_value real, -- example: [14.2, 20.9]\n fte_percentile integer, -- example: [33, 67]\n endow_value text, -- example: ['NULL', '24136']\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n PRIMARY KEY (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHarvard University refers to chronname = 'Harvard University'; highest number of first-time, full-time, degree-seeking students in the cohort being tracked, minus any exclusions refers to MAX(grad_cohort);\nIn Harvard University, which year recorded the highest number of first-time, full-time, degree-seeking students in the cohort being tracked, minus any exclusions?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Yale University', 'Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['University', 'Institute', 'Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n control text, -- example: ['Public', 'Private not-for-profit']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n nicknames text, -- example: ['NULL', 'UAB']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['B', 'X', 'W']\n cohort text, -- example: ['4y bach', '2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['B', 'A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nYale University refers to chronname = 'Yale University'; average = DIVIDE(COUNT(race = 'B' WHERE cohort = '4y bach AND year BETWEEN 2002 AND 2005), 3); Black refers to race = 'B'; bachelor's/equivalent-seeking cohort at 4-year institutions refers to cohort = '4y bach'; between 2002 to 2005 refers to year BETWEEN '2002' AND '2005';\nIn Yale University, what is the average number of Black students per year who were bachelor's/equivalent-seeking cohort at 4-year institutions between 2002 to 2005?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT AVG(T2.grad_cohort) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.chronname = 'Yale University' AND T2.year BETWEEN 2002 AND 2005 AND T2.race = 'B' AND T2.cohort = '4y bach'", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT AVG(T2.grad_cohort) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.chronname = 'Yale University' AND T2.year BETWEEN 2002 AND 2005 AND T2.race = 'B' AND T2.cohort = '4y bach'", "index": 1832, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Yale University', 'Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['University', 'Institute', 'Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n control text, -- example: ['Public', 'Private not-for-profit']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n nicknames text, -- example: ['NULL', 'UAB']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['B', 'X', 'W']\n cohort text, -- example: ['4y bach', '2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['B', 'A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nYale University refers to chronname = 'Yale University'; average = DIVIDE(COUNT(race = 'B' WHERE cohort = '4y bach AND year BETWEEN 2002 AND 2005), 3); Black refers to race = 'B'; bachelor's/equivalent-seeking cohort at 4-year institutions refers to cohort = '4y bach'; between 2002 to 2005 refers to year BETWEEN '2002' AND '2005';\nIn Yale University, what is the average number of Black students per year who were bachelor's/equivalent-seeking cohort at 4-year institutions between 2002 to 2005?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Pennsylvania', 'Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['Pennsylvania', 'United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['University of Pennsylvania', 'Princeton University', 'Columbia University', 'Harvard University', 'Cornell University', 'Dartmouth College']\n city text, -- example: ['University', 'Princeton', 'Columbia', 'Normal', 'Birmingham']\n state text, -- example: ['Pennsylvania', 'Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_value real, -- example: [71.2, 35.1]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n nicknames text, -- example: ['NULL', 'UAB']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIvy League Schools refers to chronname = 'Brown University' or chronname = 'Columbia University' or chronname = 'Cornell University' or chronname = 'Dartmouth College' or chronname = 'Harvard University' or chronname = 'Princeton University' or chronname = 'University of Pennsylvania' or chronname = 'Yale University'; lowest state appropriations to higher education in fiscal year 2011 per resident refers to MIN(state_appr_value);\nBetween the Ivy League Schools, which school's state have the lowest sate appropriations to higher education in fiscal year 2011 per resident?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.state FROM institution_details AS T1 INNER JOIN state_sector_details AS T2 ON T2.state = T1.state WHERE T1.chronname IN ( 'Brown University', 'Columbia University', 'Cornell University', 'Dartmouth College', 'Harvard University', 'Princeton University', 'University of Pennsylvania', 'Yale University' ) GROUP BY T1.state ORDER BY SUM(T2.state_appr_value) ASC LIMIT 1", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT T1.state FROM institution_details AS T1 INNER JOIN state_sector_details AS T2 ON T2.state = T1.state WHERE T1.chronname IN ( 'Brown University', 'Columbia University', 'Cornell University', 'Dartmouth College', 'Harvard University', 'Princeton University', 'University of Pennsylvania', 'Yale University' ) GROUP BY T1.state ORDER BY SUM(T2.state_appr_value) ASC LIMIT 1", "index": 1833, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Pennsylvania', 'Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'F']\n race text, -- example: ['A', 'Ai']\n cohort text, -- example: ['4y bach', '4y other']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['Pennsylvania', 'United States', 'Alabama']\n state_post text, -- example: ['U.S.', 'Ala.']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n state_appr_rank text, -- example: ['NULL', '11']\n grad_rate_rank text, -- example: ['23', '18']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['University of Pennsylvania', 'Princeton University', 'Columbia University', 'Harvard University', 'Cornell University', 'Dartmouth College']\n city text, -- example: ['University', 'Princeton', 'Columbia', 'Normal', 'Birmingham']\n state text, -- example: ['Pennsylvania', 'Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n hbcu text, -- Historically Black College and Universities, example: ['X', 'NULL']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n student_count integer, -- example: [4051, 11502]\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_state_value real, -- example: [18.8, 17.8]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_100_percentile integer, -- graduation 100 percentile, example: [15, 67]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_value real, -- example: [71.2, 35.1]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_value real, -- full time faculty value, example: [82.8, 92.4]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_elsewhere_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['5.3', '10.5']\n vsa_enroll_after6_first text, -- voluntary system of accountability enrollment after 6 year first time, example: ['12.5', '7.9']\n vsa_enroll_elsewhere_after6_first text, -- voluntary system of accountability enrollment elsewhere after 6 year first time, example: ['14.6', '13.1']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n nicknames text, -- example: ['NULL', 'UAB']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['2y all', '4y other']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIvy League Schools refers to chronname = 'Brown University' or chronname = 'Columbia University' or chronname = 'Cornell University' or chronname = 'Dartmouth College' or chronname = 'Harvard University' or chronname = 'Princeton University' or chronname = 'University of Pennsylvania' or chronname = 'Yale University'; lowest state appropriations to higher education in fiscal year 2011 per resident refers to MIN(state_appr_value);\nBetween the Ivy League Schools, which school's state have the lowest sate appropriations to higher education in fiscal year 2011 per resident?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n control text, -- example: ['Public', 'Private not-for-profit']\n lat_y real, -- example: [34.783368, 33.50223]\n student_count integer, -- example: [4051, 11502]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n pell_value real, -- example: [71.2, 35.1]\n retain_value real, -- example: [63.1, 80.2]\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n cohort text, -- example: ['4y bach', '4y other']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n grad_rate_rank text, -- example: ['23', '18']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n race text, -- example: ['X', 'W']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest number of schools refers to MAX(schools_count); percentage of no less than 90 of undergraduates who attend full-time refers to ft_pct > 90; institutions' names refers to chronname;\nIn the state with the highest number of schools, how many institutions have a percentage of no less than 90 of undergraduates who attend full-time? List all of the institutions' names.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(t1.unitid), t1.chronname FROM institution_details AS T1 INNER JOIN state_sector_details AS T2 ON t1.state = t2.state WHERE t1.ft_pct > 90 ORDER BY t2.schools_count DESC LIMIT 1", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT COUNT(t1.unitid), t1.chronname FROM institution_details AS T1 INNER JOIN state_sector_details AS T2 ON t1.state = t2.state WHERE t1.ft_pct > 90 ORDER BY t2.schools_count DESC LIMIT 1", "index": 1834, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n control text, -- example: ['Public', 'Private not-for-profit']\n lat_y real, -- example: [34.783368, 33.50223]\n student_count integer, -- example: [4051, 11502]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n pell_value real, -- example: [71.2, 35.1]\n retain_value real, -- example: [63.1, 80.2]\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_enroll_after4_transfer text, -- voluntary system of accountability enrollment after 4 years transfer, example: ['40.9', 'NULL']\n vsa_grad_elsewhere_after6_transfer text, -- voluntary system of accountability graduation elsewhere after 6 years transfer, example: ['5.6', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n cohort text, -- example: ['4y bach', '4y other']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n grad_rate_rank text, -- example: ['23', '18']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n race text, -- example: ['X', 'W']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest number of schools refers to MAX(schools_count); percentage of no less than 90 of undergraduates who attend full-time refers to ft_pct > 90; institutions' names refers to chronname;\nIn the state with the highest number of schools, how many institutions have a percentage of no less than 90 of undergraduates who attend full-time? List all of the institutions' names.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['F', 'B']\n race text, -- example: ['A', 'Ai']\n cohort text, -- example: ['4y other', '4y bach']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Institute', 'Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_value real, -- example: [71.2, 35.1]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n nicknames text, -- example: ['NULL', 'UAB']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_rank text, -- example: ['NULL', '11']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['F', 'B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['4y other', '2y all']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\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 school refers to chronname; highest number of first-time, full-time, degree-seeking female students in the cohort being tracked, minus any exclusions refers to MAX(grad_cohort WHERE gender = 'F'); seeking another type of degree or certificate at a 4-year institution refers to cohort = '4y other';\nWhat is the name of the school with the highest number of first-time, full-time, degree-seeking female students in the cohort being tracked, minus any exclusions who were seeking another type of degree or certificate at a 4-year institution?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.chronname FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T2.gender = 'F' AND T2.cohort = '4y other' ORDER BY T2.grad_cohort DESC LIMIT 1", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT T1.chronname FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T2.gender = 'F' AND T2.cohort = '4y other' ORDER BY T2.grad_cohort DESC LIMIT 1", "index": 1835, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n state_abbr text, -- example: ['AL', 'AK']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n level text, -- example: ['4-year', '2-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['F', 'B']\n race text, -- example: ['A', 'Ai']\n cohort text, -- example: ['4y other', '4y bach']\n grad_cohort text, -- graduation cohort, example: ['0', '1']\n grad_100 text, -- graduation 100, example: ['0', '2']\n grad_100_rate text, -- example: ['NULL', '0']\n grad_150_rate text, -- example: ['NULL', '0']\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n city text, -- example: ['Institute', 'Normal', 'Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Public', 'Private not-for-profit']\n basic text, -- example: ['Masters Colleges and Universities--large', 'Research Universities--very high researc']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n lat_y real, -- example: [34.783368, 33.50223]\n site text, -- example: ['www.aamu.edu/', 'www.uab.edu']\n awards_per_value real, -- example: [14.2, 20.9]\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n exp_award_state_value integer, -- expected award state value, example: [75743, 92268]\n exp_award_percentile integer, -- example: [90, 97]\n ft_pct real, -- Full-time percentage, example: [93.8, 72.7]\n fte_value integer, -- Full-time percentage, example: [3906, 10032]\n fte_percentile integer, -- example: [33, 67]\n med_sat_value text, -- median SAT value, example: ['823', '1146']\n med_sat_percentile text, -- median SAT percentile, example: ['0', '84']\n aid_value integer, -- example: [7142, 6088]\n aid_percentile integer, -- example: [72, 50]\n endow_value text, -- example: ['NULL', '24136']\n endow_percentile text, -- example: ['NULL', '93']\n grad_100_value real, -- graduation 100 value, example: [10.0, 29.4]\n grad_150_value real, -- graduation 150 value, example: [29.1, 53.5]\n grad_150_percentile integer, -- graduation 150 percentile, example: [14, 66]\n pell_value real, -- example: [71.2, 35.1]\n pell_percentile integer, -- example: [98, 39]\n retain_value real, -- example: [63.1, 80.2]\n retain_percentile integer, -- example: [17, 70]\n ft_fac_percentile integer, -- full time faculty percentile, example: [89, 98]\n vsa_year text, -- voluntary system of accountability year, example: ['2010', '2011']\n vsa_grad_after4_first text, -- voluntary system of accountability after 4 year first time, example: ['14.7', '22.3']\n vsa_grad_elsewhere_after4_first text, -- voluntary system of accountability graduation elsewhere after 4 year first time, example: ['2', '2.9']\n vsa_enroll_after4_first text, -- voluntary system of accountability enrollment after 4 year first time, example: ['36.5', '34.2']\n vsa_enroll_elsewhere_after4_first text, -- voluntary system of accountability enrollment elsewhere after 4 year first time, example: ['16.1', '19.2']\n vsa_grad_after6_first text, -- voluntary system of accountability graduation elsewhere after 6 year first time, example: ['33', '42.6']\n vsa_grad_after4_transfer text, -- voluntary system of accountability transfer after 6 year first time, example: ['15.7', 'NULL']\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n vsa_enroll_elsewhere_after4_transfer text, -- voluntary system of accountability enrollment elsewhere after 4 years transfer, example: ['17.2', 'NULL']\n vsa_grad_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['36.4', 'NULL']\n vsa_enroll_after6_transfer text, -- voluntary system of accountability enrollment after 6 years transfer, example: ['17.2', 'NULL']\n vsa_enroll_elsewhere_after6_transfer text, -- voluntary system of accountability enrollment elsewhere after 6 years transfer, example: ['11.1', 'NULL']\n similar text, -- example: ['232937|100724|405997|113607|139533|14400', '196060|180461|201885|145600|209542|23693']\n state_sector_ct integer, -- example: [13, 16]\n carnegie_ct integer, -- example: [386, 106]\n counted_pct text, -- example: ['99.7|07', '56.0|07']\n nicknames text, -- example: ['NULL', 'UAB']\n cohort_size integer, -- example: [882, 1376]\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n level text, -- example: ['4-year', '2-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n schools_count integer, -- example: [632, 1180]\n counted_pct text, -- counted percentage, example: ['NULL', '61']\n awards_per_state_value text, -- example: ['NULL', '18.8']\n awards_per_natl_value real, -- awards per national value, example: [21.5, 22.5]\n exp_award_natl_value integer, -- expected award national value, example: [66436, 101725]\n state_appr_rank text, -- example: ['NULL', '11']\n awards_per_rank text, -- example: ['NULL', '42']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['F', 'B', 'M']\n race text, -- example: ['X', 'W']\n cohort text, -- example: ['4y other', '2y all']\n grad_cohort text, -- graduation cohort, example: ['446', '185']\n grad_100 text, -- graduation 100, example: ['73', 'NULL']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_100_rate text, -- example: ['16.4', 'NULL']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\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 school refers to chronname; highest number of first-time, full-time, degree-seeking female students in the cohort being tracked, minus any exclusions refers to MAX(grad_cohort WHERE gender = 'F'); seeking another type of degree or certificate at a 4-year institution refers to cohort = '4y other';\nWhat is the name of the school with the highest number of first-time, full-time, degree-seeking female students in the cohort being tracked, minus any exclusions who were seeking another type of degree or certificate at a 4-year institution?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['M', 'B']\n race text, -- example: ['H', 'X', 'W']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['2-year', '4-year']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n level text, -- example: ['2-year', '4-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['M', 'B', 'F']\n race text, -- example: ['H', 'A', 'Ai']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbetween 2011 to 2013 refers to year BETWEEN '2011' AND '2013'; male refers to gender = 'M'; Hispanic refers to race = 'H'; number of degree-seeking students at 2-year institutions who graduated within 150 percent of normal/expected time refers to grad_150; United Education Institute-Huntington Park Campus refers to chronname = 'United Education Institute-Huntington Park Campus';\nBetween 2011 to 2013, what is the average number of male Hispanic degree-seeking students at 2-year institutions who graduated within 150 percent of normal/expected time in United Education Institute-Huntington Park Campus?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT AVG(T2.grad_150) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.chronname = 'United Education Institute-Huntington Park Campus' AND T2.year BETWEEN 2011 AND 2013 AND T2.gender = 'M' AND T2.race = 'H'", "style": "rule" }
{ "db_id": "college_completion.sqlite", "gt_sql": "SELECT AVG(T2.grad_150) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.chronname = 'United Education Institute-Huntington Park Campus' AND T2.year BETWEEN 2011 AND 2013 AND T2.gender = 'M' AND T2.race = 'H'", "index": 1836, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE institution_grads (\n unitid integer, -- example: [100760, 101028]\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['M', 'B']\n race text, -- example: ['H', 'X', 'W']\n grad_150 text, -- graduation 150, example: ['105', '40']\n grad_150_rate text, -- example: ['23.5', '21.6']\n CONSTRAINT fk_institution_grads_unitid FOREIGN KEY (unitid) REFERENCES institution_details (unitid)\n);\n\nCREATE TABLE state_sector_details (\n stateid integer, -- example: [0, 1]\n state text, -- state name, example: ['United States', 'Alabama']\n level text, -- example: ['2-year', '4-year']\n control text, -- example: ['Private for-profit', 'Private not-for-profit']\n exp_award_state_value text, -- expected award state value, example: ['NULL', '75743']\n state_appr_value text, -- state appropriation value, example: ['NULL', '290.68']\n PRIMARY KEY (stateid, level, control),\n CONSTRAINT fk_state_sector_details_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\n\nCREATE TABLE institution_details (\n unitid integer, -- Unit ID number, example: [100654, 100663]\n chronname text, -- example: ['Alabama A&M University', 'University of Alabama at Birmingham']\n state text, -- example: ['Alabama', 'Alaska']\n level text, -- example: ['2-year', '4-year']\n flagship text, -- example: ['NULL', 'X']\n long_x real, -- example: [-86.568502, -86.80917]\n exp_award_value integer, -- expected award value, example: [105331, 136546]\n vsa_grad_elsewhere_after4_transfer text, -- voluntary system of accountability graduation elsewhere after 4 year, example: ['1.5', 'NULL']\n PRIMARY KEY (unitid)\n);\n\nCREATE TABLE state_sector_grads (\n stateid integer, -- example: [1, 2]\n state text, -- state name, example: ['Alabama', 'Alaska']\n level text, -- example: ['2-year', '4-year']\n `year` integer, -- example: [2011, 2012]\n gender text, -- example: ['M', 'B', 'F']\n race text, -- example: ['H', 'A', 'Ai']\n grad_150 text, -- graduation 150, example: ['0', '3']\n grad_cohort_ct integer, -- graduation cohort count, example: [9, 16]\n CONSTRAINT fk_state_sector_grads_stateid FOREIGN KEY (stateid) REFERENCES state_sector_details (stateid),\n CONSTRAINT fk_state_sector_grads_state FOREIGN KEY (state) REFERENCES institution_details (state)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbetween 2011 to 2013 refers to year BETWEEN '2011' AND '2013'; male refers to gender = 'M'; Hispanic refers to race = 'H'; number of degree-seeking students at 2-year institutions who graduated within 150 percent of normal/expected time refers to grad_150; United Education Institute-Huntington Park Campus refers to chronname = 'United Education Institute-Huntington Park Campus';\nBetween 2011 to 2013, what is the average number of male Hispanic degree-seeking students at 2-year institutions who graduated within 150 percent of normal/expected time in United Education Institute-Huntington Park Campus?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_useful text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAZ refers to state = 'AZ'; stars < 3;\nHow many Yelp businesses are there in 'AZ' with less than \"3\" stars?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(business_id) FROM Business WHERE state LIKE 'AZ' AND stars < 3", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(business_id) FROM Business WHERE state LIKE 'AZ' AND stars < 3", "index": 1837, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_useful text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAZ refers to state = 'AZ'; stars < 3;\nHow many Yelp businesses are there in 'AZ' with less than \"3\" stars?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Buffets', 'Gyms', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbuffets refers to category_name = 'Buffets'; gyms refers to category_name = 'Gyms'; difference = SUBTRACT(SUM(category_name = 'Buffets'), SUM(category_name = 'Gyms'));\nHow many more \"buffets\" than \"gyms\" in Yelp business?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(CASE WHEN T1.category_name LIKE 'Buffets' THEN 1 ELSE 0 END) - SUM(CASE WHEN T1.category_name LIKE 'Gyms' THEN 1 ELSE 0 END) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT SUM(CASE WHEN T1.category_name LIKE 'Buffets' THEN 1 ELSE 0 END) - SUM(CASE WHEN T1.category_name LIKE 'Gyms' THEN 1 ELSE 0 END) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id", "index": 1838, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Buffets', 'Gyms', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbuffets refers to category_name = 'Buffets'; gyms refers to category_name = 'Gyms'; difference = SUBTRACT(SUM(category_name = 'Buffets'), SUM(category_name = 'Gyms'));\nHow many more \"buffets\" than \"gyms\" in Yelp business?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n state text, -- example: ['AZ', 'SC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Short', 'Medium']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshort tips refers to tip_length = 'short'; most number of short tips refers to MAX(COUNT(tip_length = 'short')); category refers to category_name;\nFor the Yelp business which had the most number of \"short\" tips, which category does it belong to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT T1.category_name FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id INNER JOIN Tips AS T4 ON T3.business_id = T4.business_id WHERE T4.tip_length LIKE 'short'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT DISTINCT T1.category_name FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id INNER JOIN Tips AS T4 ON T3.business_id = T4.business_id WHERE T4.tip_length LIKE 'short'", "index": 1839, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n state text, -- example: ['AZ', 'SC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Short', 'Medium']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshort tips refers to tip_length = 'short'; most number of short tips refers to MAX(COUNT(tip_length = 'short')); category refers to category_name;\nFor the Yelp business which had the most number of \"short\" tips, which category does it belong to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_2 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_20 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nuser No. refers to user_id; short tip refers to tip_length = 'short'; category refers to category_name;\nUser No. 70271 only has given one tip to the Yelp business, which category was that business belonged 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 T4.category_name FROM Tips AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id INNER JOIN Business_Categories AS T3 ON T2.business_id = T3.business_id INNER JOIN Categories AS T4 ON T3.category_id = T4.category_id WHERE T1.user_id = 70271", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T4.category_name FROM Tips AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id INNER JOIN Business_Categories AS T3 ON T2.business_id = T3.business_id INNER JOIN Categories AS T4 ON T3.category_id = T4.category_id WHERE T1.user_id = 70271", "index": 1840, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_2 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_20 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nuser No. refers to user_id; short tip refers to tip_length = 'short'; category refers to category_name;\nUser No. 70271 only has given one tip to the Yelp business, which category was that business belonged 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 Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Short', 'Medium']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshort tip refers to tip_lenghth = 'short'; user No. refers to user_id; ratings refers to stars; stars = 5 means great experience; stars = 4 means good experience; stars = 3 means average experience; stars = 2 means bad experience; stars = 1 means terrible experience;\n\nThere was only one tip that user No. 69722 gave to the Yelp business, what was the ratings of that business?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.stars FROM Tips AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T1.user_id = 69722", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T2.stars FROM Tips AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T1.user_id = 69722", "index": 1841, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Short', 'Medium']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshort tip refers to tip_lenghth = 'short'; user No. refers to user_id; ratings refers to stars; stars = 5 means great experience; stars = 4 means good experience; stars = 3 means average experience; stars = 2 means bad experience; stars = 1 means terrible experience;\n\nThere was only one tip that user No. 69722 gave to the Yelp business, what was the ratings of that business?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Automotive', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nautomotive businesses refers to category_name = 'Automotive'; percentage = MULTIPLY(DIVIDE(SUM(category_name = 'Automotive'), COUNT(business_id)), 1.0);\nGive the percentage of \"Automotive\" businesses among all the Yelp businesses.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(CASE WHEN T2.category_name LIKE 'Automotive' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.business_id) AS \"percentage\" FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T2.category_name LIKE 'Automotive' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.business_id) AS \"percentage\" FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id", "index": 1842, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Automotive', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nautomotive businesses refers to category_name = 'Automotive'; percentage = MULTIPLY(DIVIDE(SUM(category_name = 'Automotive'), COUNT(business_id)), 1.0);\nGive the percentage of \"Automotive\" businesses among all the Yelp businesses.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_useful text, -- example: ['Low', 'Medium']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\njoined yelp since 2004 refers to user_yelping_since_year = 2004;\nGive the number of users who joined Yelp since \"2004\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(user_id) FROM Users WHERE user_yelping_since_year = 2004", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(user_id) FROM Users WHERE user_yelping_since_year = 2004", "index": 1843, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_useful text, -- example: ['Low', 'Medium']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\njoined yelp since 2004 refers to user_yelping_since_year = 2004;\nGive the number of users who joined Yelp since \"2004\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\njoined Yelp since 2005 refers to user_yelping_since_year = 2005; no fans refers to user_fans = 'None';\nHow many users who have joined Yelp since \"2005\" but have no fans?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(user_id) FROM Users WHERE user_yelping_since_year = 2005 AND user_fans LIKE 'None'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(user_id) FROM Users WHERE user_yelping_since_year = 2005 AND user_fans LIKE 'None'", "index": 1844, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\njoined Yelp since 2005 refers to user_yelping_since_year = 2005; no fans refers to user_fans = 'None';\nHow many users who have joined Yelp since \"2005\" but have no fans?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Tolleson', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactively running refers to active = 'TRUE'; Tolleson refers to city = 'Tolleson';\nState the number of actively running Yelp businesses in \"Tolleson\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(business_id) FROM Business WHERE city LIKE 'Tolleson' AND active LIKE 'TRUE'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(business_id) FROM Business WHERE city LIKE 'Tolleson' AND active LIKE 'TRUE'", "index": 1845, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Tolleson', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactively running refers to active = 'TRUE'; Tolleson refers to city = 'Tolleson';\nState the number of actively running Yelp businesses in \"Tolleson\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Yuma', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Medium', 'Low']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['Medium', 'None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['Medium', 'None', 'Low']\n label_time_11 text, -- example: ['Medium', 'Low', 'None']\n label_time_12 text, -- example: ['Medium', 'None', 'Low']\n label_time_14 text, -- example: ['Medium', 'None', 'Low']\n label_time_15 text, -- example: ['Medium', 'None', 'Low']\n label_time_16 text, -- example: ['Medium', 'None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmedium reviews refers to review_length = 'Medium';\nFor the only Yelp business in \"Yuma\" city, how many \"medium\" reviews did it 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 COUNT(T2.review_length) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.city LIKE 'Yuma' AND T2.review_length LIKE 'Medium'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(T2.review_length) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.city LIKE 'Yuma' AND T2.review_length LIKE 'Medium'", "index": 1846, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Yuma', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Medium', 'Low']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['Medium', 'None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['Medium', 'None', 'Low']\n label_time_11 text, -- example: ['Medium', 'Low', 'None']\n label_time_12 text, -- example: ['Medium', 'None', 'Low']\n label_time_14 text, -- example: ['Medium', 'None', 'Low']\n label_time_15 text, -- example: ['Medium', 'None', 'Low']\n label_time_16 text, -- example: ['Medium', 'None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmedium reviews refers to review_length = 'Medium';\nFor the only Yelp business in \"Yuma\" city, how many \"medium\" reviews did it 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 Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Has TV', 'Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusiness No. refers to business_id; have TV refers to attribute_name = 'Has TV';\nDoes Yelp business No.\"4960\" have TV?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT CASE WHEN T1.attribute_name LIKE 'Has TV' THEN 'yes' ELSE 'no' END FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T2.business_id = 4960", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT DISTINCT CASE WHEN T1.attribute_name LIKE 'Has TV' THEN 'yes' ELSE 'no' END FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T2.business_id = 4960", "index": 1847, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Has TV', 'Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusiness No. refers to business_id; have TV refers to attribute_name = 'Has TV';\nDoes Yelp business No.\"4960\" have TV?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Saturday', 'Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_useful text, -- example: ['Low', 'Medium']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n PRIMARY KEY (business_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 hours = SUBTRACT(closing_time, opening_time); business No. refers to business_id; open on Saturday refers to day_of_week = 'Saturday';\nHow many hours does the Yelp business No. \"5734\" open on Saturday?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.closing_time - T1.opening_time AS \"hour\" FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id WHERE T2.day_of_week LIKE 'Saturday' AND T1.business_id = 5734", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T1.closing_time - T1.opening_time AS \"hour\" FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id WHERE T2.day_of_week LIKE 'Saturday' AND T1.business_id = 5734", "index": 1848, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Saturday', 'Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_useful text, -- example: ['Low', 'Medium']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n PRIMARY KEY (business_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 hours = SUBTRACT(closing_time, opening_time); business No. refers to business_id; open on Saturday refers to day_of_week = 'Saturday';\nHow many hours does the Yelp business No. \"5734\" open on Saturday?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_5 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Hair Removal', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhair removal refers to category_name = 'Hair Removal';\nTell the number of \"hair removal\" Yelp businesses.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.category_id) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id WHERE T1.category_name LIKE 'Hair Removal'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(T1.category_id) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id WHERE T1.category_name LIKE 'Hair Removal'", "index": 1849, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_5 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Hair Removal', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhair removal refers to category_name = 'Hair Removal';\nTell the number of \"hair removal\" Yelp businesses.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_funny text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nuser No. refers to user_id;\nUser No.\"63469\" has got \"1\" like for a tip to the Yelp business, which city is that business located in?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.city FROM Business AS T1 INNER JOIN Tips AS T2 ON T1.business_id = T2.business_id WHERE T2.likes = 1 AND T2.user_id = 63469", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T1.city FROM Business AS T1 INNER JOIN Tips AS T2 ON T1.business_id = T2.business_id WHERE T2.likes = 1 AND T2.user_id = 63469", "index": 1850, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_funny text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nuser No. refers to user_id;\nUser No.\"63469\" has got \"1\" like for a tip to the Yelp business, which city is that business located in?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['funny', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['High', 'None', 'Low']\n label_time_1 text, -- example: ['High', 'None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_11 text, -- example: ['High', 'Low', 'None']\n label_time_12 text, -- example: ['High', 'None', 'Low']\n label_time_13 text, -- example: ['High', 'None', 'Low']\n label_time_15 text, -- example: ['High', 'None', 'Low']\n label_time_16 text, -- example: ['High', 'None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntype of compliments refers to compliment_type; most number of funny type of compliments refers to MAX(COUNT(number of compliments = 'high' WHERE compliment_type = 'funny'));\nWho has got the most number of \"funny\" type of compliments? Give the user ID.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT user_id FROM Users_Compliments WHERE compliment_id IN ( SELECT compliment_id FROM Compliments WHERE compliment_type LIKE 'funny' )", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT user_id FROM Users_Compliments WHERE compliment_id IN ( SELECT compliment_id FROM Compliments WHERE compliment_type LIKE 'funny' )", "index": 1851, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['funny', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['High', 'None', 'Low']\n label_time_1 text, -- example: ['High', 'None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_11 text, -- example: ['High', 'Low', 'None']\n label_time_12 text, -- example: ['High', 'None', 'Low']\n label_time_13 text, -- example: ['High', 'None', 'Low']\n label_time_15 text, -- example: ['High', 'None', 'Low']\n label_time_16 text, -- example: ['High', 'None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntype of compliments refers to compliment_type; most number of funny type of compliments refers to MAX(COUNT(number of compliments = 'high' WHERE compliment_type = 'funny'));\nWho has got the most number of \"funny\" type of compliments? Give the user ID.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Scottsdale', 'Phoenix']\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Drive-Thru', 'Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndrive-thru refers to attribute_name = 'Drive-Thru' AND attribute_value = 'true'; Scottsdale refers to city = 'Scottsdale'; business_id < 1000;\nGive the number of \"drive-thru\" businesses in \"Scottsdale\" with business ID number less than \"1000\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.business_id FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T3.business_id < 1000 AND T3.city LIKE 'Scottsdale' AND T1.attribute_name LIKE 'Drive-Thru' AND T2.attribute_value LIKE 'TRUE'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T2.business_id FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T3.business_id < 1000 AND T3.city LIKE 'Scottsdale' AND T1.attribute_name LIKE 'Drive-Thru' AND T2.attribute_value LIKE 'TRUE'", "index": 1852, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Scottsdale', 'Phoenix']\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Drive-Thru', 'Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndrive-thru refers to attribute_name = 'Drive-Thru' AND attribute_value = 'true'; Scottsdale refers to city = 'Scottsdale'; business_id < 1000;\nGive the number of \"drive-thru\" businesses in \"Scottsdale\" with business ID number less than \"1000\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['average', 'true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Open 24 Hours', 'Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nopen 24 hours refers to attribute_name = 'Open 24 Hours' AND attribute_value = 'true'; rating refers to stars; average rating = AVG(stars);\nWhat is the average rating for the all Yelp businesses that open 24 hours?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(T3.stars) AS REAL) / COUNT(T2.business_id) AS \"avg\" FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.attribute_name LIKE 'Open 24 Hours' AND T2.attribute_value LIKE 'TRUE'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT CAST(SUM(T3.stars) AS REAL) / COUNT(T2.business_id) AS \"avg\" FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.attribute_name LIKE 'Open 24 Hours' AND T2.attribute_value LIKE 'TRUE'", "index": 1853, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['average', 'true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Open 24 Hours', 'Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nopen 24 hours refers to attribute_name = 'Open 24 Hours' AND attribute_value = 'true'; rating refers to stars; average rating = AVG(stars);\nWhat is the average rating for the all Yelp businesses that open 24 hours?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['list', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_9 text, -- example: ['Low', 'None']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAZ refers to state = 'AZ'; rating refers to stars;\nList the names of business in AZ with a rating of 5.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT business_id FROM Business WHERE state LIKE 'AZ' AND stars = 5", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT business_id FROM Business WHERE state LIKE 'AZ' AND stars = 5", "index": 1854, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['list', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_9 text, -- example: ['Low', 'None']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAZ refers to state = 'AZ'; rating refers to stars;\nList the names of business in AZ with a rating of 5.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nuser_id BETWEEN 1 AND 20; no fan users refers to user_fans = 'None'; low ratings refers to user_review_count = 'Low';\nHow many user ids from 1 to 20 have no fan users and have low ratings?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(user_id) FROM Users WHERE user_id BETWEEN 1 AND 20 AND user_fans LIKE 'None' AND user_review_count LIKE 'Low'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(user_id) FROM Users WHERE user_id BETWEEN 1 AND 20 AND user_fans LIKE 'None' AND user_review_count LIKE 'Low'", "index": 1855, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nuser_id BETWEEN 1 AND 20; no fan users refers to user_fans = 'None'; low ratings refers to user_review_count = 'Low';\nHow many user ids from 1 to 20 have no fan users and have low ratings?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Pets', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_2 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['9PM', '11AM', '12PM']\n closing_time text, -- example: ['9PM', '8PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncategory refers to category_name; open after 9pm refers to closing_time > '9PM';\nProvide name of businesses whose category is pets and are still opened after 9PM.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.business_id FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id INNER JOIN Business_Hours AS T4 ON T3.business_id = T4.business_id WHERE T4.closing_time > '9PM' AND T1.category_name LIKE 'Pets'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T3.business_id FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id INNER JOIN Business_Hours AS T4 ON T3.business_id = T4.business_id WHERE T4.closing_time > '9PM' AND T1.category_name LIKE 'Pets'", "index": 1856, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Pets', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_2 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['9PM', '11AM', '12PM']\n closing_time text, -- example: ['9PM', '8PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncategory refers to category_name; open after 9pm refers to closing_time > '9PM';\nProvide name of businesses whose category is pets and are still opened after 9PM.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix ', 'Phoenix', 'Scottsdale']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_8 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['Medium', 'None', 'Low']\n label_time_13 text, -- example: ['Medium', 'None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmedium refers to number_of_compliments = 'Medium';\nHow many compliments received from medium users that Phoenix city achieved?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.number_of_compliments) FROM Users_Compliments AS T1 INNER JOIN Reviews AS T2 ON T1.user_id = T2.user_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T3.city LIKE 'Phoenix' AND T1.number_of_compliments LIKE 'Medium'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(T1.number_of_compliments) FROM Users_Compliments AS T1 INNER JOIN Reviews AS T2 ON T1.user_id = T2.user_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T3.city LIKE 'Phoenix' AND T1.number_of_compliments LIKE 'Medium'", "index": 1857, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix ', 'Phoenix', 'Scottsdale']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_8 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['Medium', 'None', 'Low']\n label_time_13 text, -- example: ['Medium', 'None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmedium refers to number_of_compliments = 'Medium';\nHow many compliments received from medium users that Phoenix city achieved?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['8AM', '11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Tempe', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nopening hours refers to opening_time; earlier than 8AM refers to opening_time < '8AM';\nProvide the businesses name in Tempe city whose opening hours are earlier than 8AM.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.category_name FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id INNER JOIN Business_Hours AS T4 ON T3.business_id = T4.business_id WHERE T3.city LIKE 'Tempe' AND T4.opening_time < '8AM'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T1.category_name FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id INNER JOIN Business_Hours AS T4 ON T3.business_id = T4.business_id WHERE T3.city LIKE 'Tempe' AND T4.opening_time < '8AM'", "index": 1858, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['8AM', '11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Tempe', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nopening hours refers to opening_time; earlier than 8AM refers to opening_time < '8AM';\nProvide the businesses name in Tempe city whose opening hours are earlier than 8AM.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_useful text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Glendale', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['6PM', '8AM', '11AM', '12PM']\n closing_time text, -- example: ['6PM', '8AM', '8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstill running refers to active = 'true'; opened from 8AM to 6PM refers to opening_time = '8AM' AND closing_time = '6PM';\nHow many businesses in Glendale city that are still running is opened from 8AM to 6PM?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.category_name) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id INNER JOIN Business_Hours AS T4 ON T3.business_id = T4.business_id WHERE T3.city LIKE 'Glendale' AND T4.opening_time LIKE '8AM' AND T4.closing_time LIKE '6PM'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(T1.category_name) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id INNER JOIN Business_Hours AS T4 ON T3.business_id = T4.business_id WHERE T3.city LIKE 'Glendale' AND T4.opening_time LIKE '8AM' AND T4.closing_time LIKE '6PM'", "index": 1859, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_useful text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Glendale', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['6PM', '8AM', '11AM', '12PM']\n closing_time text, -- example: ['6PM', '8AM', '8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstill running refers to active = 'true'; opened from 8AM to 6PM refers to opening_time = '8AM' AND closing_time = '6PM';\nHow many businesses in Glendale city that are still running is opened from 8AM to 6PM?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_3 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['Low', 'None']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['Low', 'None']\n label_time_15 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncategory refers to category_name; percentage = MULTIPLY(DIVIDE(SUM(category_name = 'Active Life'), SUM(review_count = 'LOW')), 1.0);\nHow many cities have businesses with active life category? Find the percentage of the city where the review count that is low in total review count.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.category_name LIKE 'Active Life' THEN 1 ELSE 0 END) AS \"num\" , CAST(SUM(CASE WHEN T3.city LIKE 'Phoenix' THEN 1 ELSE 0 END) AS REAL) * 100 / ( SELECT COUNT(T3.review_count) FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T1.business_id = T3.business_id WHERE T3.review_count LIKE 'Low' ) FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T1.business_id = T3.business_id", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT SUM(CASE WHEN T2.category_name LIKE 'Active Life' THEN 1 ELSE 0 END) AS \"num\" , CAST(SUM(CASE WHEN T3.city LIKE 'Phoenix' THEN 1 ELSE 0 END) AS REAL) * 100 / ( SELECT COUNT(T3.review_count) FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T1.business_id = T3.business_id WHERE T3.review_count LIKE 'Low' ) FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T1.business_id = T3.business_id", "index": 1860, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_3 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['Low', 'None']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['Low', 'None']\n label_time_15 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncategory refers to category_name; percentage = MULTIPLY(DIVIDE(SUM(category_name = 'Active Life'), SUM(review_count = 'LOW')), 1.0);\nHow many cities have businesses with active life category? Find the percentage of the city where the review count that is low in total review count.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix ', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive businesses refers to active = 'true'; Phoenix refers to city = 'Phoenix';\nHow many active businesses are there in Phoenix?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(business_id) FROM Business WHERE city LIKE 'Phoenix' AND active LIKE 'TRUE'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(business_id) FROM Business WHERE city LIKE 'Phoenix' AND active LIKE 'TRUE'", "index": 1861, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix ', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive businesses refers to active = 'true'; Phoenix refers to city = 'Phoenix';\nHow many active businesses are there in Phoenix?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Scottsdale', 'Phoenix']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nScottsdale refers to city = 'Scottsdale'; rated refers to stars; rated as wonderful experience refers to stars > 3;\nHow many businesses in Scottsdale are rated as \"wonderful experience\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(business_id) FROM Business WHERE city LIKE 'Scottsdale' AND stars > 3", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(business_id) FROM Business WHERE city LIKE 'Scottsdale' AND stars > 3", "index": 1862, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Scottsdale', 'Phoenix']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nScottsdale refers to city = 'Scottsdale'; rated refers to stars; rated as wonderful experience refers to stars > 3;\nHow many businesses in Scottsdale are rated as \"wonderful experience\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['beer_and_wine', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbeer_and_wine refers to attribute_value = 'beer_and_wine';\nHow many businesses in AZ state have the beer_and_wine attribute?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.business_id) FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id WHERE T2.attribute_value LIKE 'beer_and_wine' AND T1.state LIKE 'AZ'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id WHERE T2.attribute_value LIKE 'beer_and_wine' AND T1.state LIKE 'AZ'", "index": 1863, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['beer_and_wine', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbeer_and_wine refers to attribute_value = 'beer_and_wine';\nHow many businesses in AZ state have the beer_and_wine attribute?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['High', 'Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Food', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['High', 'None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest number of businesses refers to MAX(business_id); food industry refers to category_name = 'Food'; number of reviews is high refers to review_count = 'High';\nWhich city has the highest number of businesses in the food industry whose number of reviews is high?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.city FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.review_count LIKE 'High' AND T3.category_name LIKE 'Food' GROUP BY T1.city", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T1.city FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.review_count LIKE 'High' AND T3.category_name LIKE 'Food' GROUP BY T1.city", "index": 1864, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['High', 'Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Food', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['High', 'None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest number of businesses refers to MAX(business_id); food industry refers to category_name = 'Food'; number of reviews is high refers to review_count = 'High';\nWhich city has the highest number of businesses in the food industry whose number of reviews is high?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Real Estate', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_2 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Chandler', 'chandler', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nReal Estate sector refers to category_name = 'Real Estate'; rating of 5 refers to stars = 5; Chandler refers to city = 'Chandler'; percentage = MULTIPLY(DIVIDE(SUM(category_name = 'Real Estate' and stars = 5), COUNT(business_id)), 100);\nWhat percentage of businesses are in the Real Estate sector and have the rating of 5 out of all businesses in Chandler?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.stars = 5 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.business_id) AS \"percentage\" FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.city LIKE 'Chandler' AND T3.category_name LIKE 'Real Estate'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T1.stars = 5 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.business_id) AS \"percentage\" FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.city LIKE 'Chandler' AND T3.category_name LIKE 'Real Estate'", "index": 1865, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Real Estate', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_2 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Chandler', 'chandler', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nReal Estate sector refers to category_name = 'Real Estate'; rating of 5 refers to stars = 5; Chandler refers to city = 'Chandler'; percentage = MULTIPLY(DIVIDE(SUM(category_name = 'Real Estate' and stars = 5), COUNT(business_id)), 100);\nWhat percentage of businesses are in the Real Estate sector and have the rating of 5 out of all businesses in Chandler?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_7 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_20 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\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 useful votes refers to review_votes_useful; business number refers to business_id;\nWhat is the number of useful votes that the user 52592 received when reviewed for business number 2?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT review_votes_useful FROM Reviews WHERE user_id = 52592 AND business_id = 2", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT review_votes_useful FROM Reviews WHERE user_id = 52592 AND business_id = 2", "index": 1866, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_7 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_20 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\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 useful votes refers to review_votes_useful; business number refers to business_id;\nWhat is the number of useful votes that the user 52592 received when reviewed for business number 2?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Gilbert', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactively running refers to active = 'true';\nHow many businesses are actively running in Gilbert 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(business_id) FROM Business WHERE city LIKE 'Gilbert' AND active LIKE 'True'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(business_id) FROM Business WHERE city LIKE 'Gilbert' AND active LIKE 'True'", "index": 1867, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Gilbert', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactively running refers to active = 'true';\nHow many businesses are actively running in Gilbert 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 Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['cool', 'photos']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncool compliments refers to compliment_type = 'cool'; user number refers to user_id;\nHow many \"cool\" compliments did user number 33 receive?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.compliment_type) FROM Users_Compliments AS T1 INNER JOIN Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.user_id = 33 AND T2.compliment_type LIKE 'cool'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(T2.compliment_type) FROM Users_Compliments AS T1 INNER JOIN Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.user_id = 33 AND T2.compliment_type LIKE 'cool'", "index": 1868, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['cool', 'photos']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncool compliments refers to compliment_type = 'cool'; user number refers to user_id;\nHow many \"cool\" compliments did user number 33 receive?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_5 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Scottsdale', 'Phoenix']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Beauty & Spas', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncategory refers to category_name;\nHow many businesses are there in Scottsdale city under the category of \"Beauty & Spas\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.business_id) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T3.city LIKE 'Scottsdale' AND T1.category_name LIKE 'Beauty & Spas'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(T2.business_id) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T3.city LIKE 'Scottsdale' AND T1.category_name LIKE 'Beauty & Spas'", "index": 1869, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_5 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Scottsdale', 'Phoenix']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Beauty & Spas', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncategory refers to category_name;\nHow many businesses are there in Scottsdale city under the category of \"Beauty & Spas\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Long', 'Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Scottsdale', 'Phoenix']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusiness number refers to business_id; Scottsdale refers to city = 'Scottsdale'; day number refers to day_id;\nHow long does business number 12 in Scottsdale stay open on day number 3?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.closing_time - T2.opening_time AS \"hour\" FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T1.business_id = 12 AND T1.city LIKE 'Scottsdale' AND T2.day_id = 3", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T2.closing_time - T2.opening_time AS \"hour\" FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T1.business_id = 12 AND T1.city LIKE 'Scottsdale' AND T2.day_id = 3", "index": 1870, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Long', 'Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Scottsdale', 'Phoenix']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusiness number refers to business_id; Scottsdale refers to city = 'Scottsdale'; day number refers to day_id;\nHow long does business number 12 in Scottsdale stay open on day number 3?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_7 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_useful text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Scottsdale', 'Phoenix']\n state text, -- example: ['AZ', 'SC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nScottsdale refers to city = 'Scottsdale';\nHow many businesses of Yelp are in Scottsdale?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(business_id) FROM Business WHERE city LIKE 'Scottsdale'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(business_id) FROM Business WHERE city LIKE 'Scottsdale'", "index": 1871, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_7 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_useful text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Scottsdale', 'Phoenix']\n state text, -- example: ['AZ', 'SC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nScottsdale refers to city = 'Scottsdale';\nHow many businesses of Yelp are in Scottsdale?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Scottsdale', 'Phoenix']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nScottsdale refers to city = 'Scottsdale'; positive comments refers to stars > 3; Elitestar rating refers to stars;\nHow many Yelp_Businesses in Scottsdale have received positive comments in the Elitestar rating?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(business_id) FROM Business WHERE city LIKE 'Scottsdale' AND stars > 3", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(business_id) FROM Business WHERE city LIKE 'Scottsdale' AND stars > 3", "index": 1872, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Scottsdale', 'Phoenix']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nScottsdale refers to city = 'Scottsdale'; positive comments refers to stars > 3; Elitestar rating refers to stars;\nHow many Yelp_Businesses in Scottsdale have received positive comments in the Elitestar rating?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_22 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nArizona refers to state = 'AZ'; Elitestar rating of over 4 refers to stars > 4;\nHow many Yelp_Businesses in Arizona have a Elitestar rating of over 4?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(business_id) FROM Business WHERE state LIKE 'AZ' AND stars > 4", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(business_id) FROM Business WHERE state LIKE 'AZ' AND stars > 4", "index": 1873, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_22 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nArizona refers to state = 'AZ'; Elitestar rating of over 4 refers to stars > 4;\nHow many Yelp_Businesses in Arizona have a Elitestar rating of over 4?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_2 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_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 reviews have the user whose ID is 3 posted?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(review_length) FROM Reviews WHERE user_id = 3", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(review_length) FROM Reviews WHERE user_id = 3", "index": 1874, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_2 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_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 reviews have the user whose ID is 3 posted?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Long', 'Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['Medium', 'None', 'Low']\n label_time_1 text, -- example: ['Medium', 'None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_11 text, -- example: ['Medium', 'Low', 'None']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlong reviews refers to review_length = 'Long'; medium number of useful votes refers to review_votes_useful = 'medium';\nAmong the long reviews made by user ID 3, how many of them have received a medium number of useful votes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(review_length) FROM Reviews WHERE user_id = 3 AND review_length LIKE 'Long' AND review_votes_useful LIKE 'Medium'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(review_length) FROM Reviews WHERE user_id = 3 AND review_length LIKE 'Long' AND review_votes_useful LIKE 'Medium'", "index": 1875, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Long', 'Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['Medium', 'None', 'Low']\n label_time_1 text, -- example: ['Medium', 'None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_11 text, -- example: ['Medium', 'Low', 'None']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlong reviews refers to review_length = 'Long'; medium number of useful votes refers to review_votes_useful = 'medium';\nAmong the long reviews made by user ID 3, how many of them have received a medium number of useful votes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsince year 2012 refers to user_yelping_since_year = '2012'\nHow many users have joined Yelp since the year 2012?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(user_id) FROM Users WHERE user_yelping_since_year = 2012", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(user_id) FROM Users WHERE user_yelping_since_year = 2012", "index": 1876, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsince year 2012 refers to user_yelping_since_year = '2012'\nHow many users have joined Yelp since the year 2012?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_5 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['High', 'None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['list', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhigh number of followers refers to user_fans = 'High'\nPlease list the IDs of the users who have a high number of followers.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT user_id FROM Users WHERE user_fans LIKE 'High' GROUP BY user_id", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT user_id FROM Users WHERE user_fans LIKE 'High' GROUP BY user_id", "index": 1877, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_5 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['High', 'None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['list', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhigh number of followers refers to user_fans = 'High'\nPlease list the IDs of the users who have a high number of followers.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_7 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\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 provide alcohol refers to attribute_name = 'Alcohol'and attribute_value = 'none'\n\nHow many Yelp_Businesses do not provide alcohol?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.attribute_id) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T1.attribute_name LIKE 'Alcohol' AND T2.attribute_value LIKE 'none'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(T1.attribute_id) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T1.attribute_name LIKE 'Alcohol' AND T2.attribute_value LIKE 'none'", "index": 1878, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_7 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\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 provide alcohol refers to attribute_name = 'Alcohol'and attribute_value = 'none'\n\nHow many Yelp_Businesses do not provide alcohol?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_17 text, -- example: ['Low', 'None']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n state text, -- example: ['AZ', 'SC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nArizona refers to state = 'AZ'; do not provide alcohol refers to attribute_name = 'Alcohol' and attribute_value = 'none'\nAmong the Yelp_Businesses in Arizona, how many of them do not provide alcohol?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.business_id) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.attribute_name LIKE 'Alcohol' AND T2.attribute_value LIKE 'none' AND T3.state LIKE 'AZ'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(T2.business_id) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.attribute_name LIKE 'Alcohol' AND T2.attribute_value LIKE 'none' AND T3.state LIKE 'AZ'", "index": 1879, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_17 text, -- example: ['Low', 'None']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n state text, -- example: ['AZ', 'SC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nArizona refers to state = 'AZ'; do not provide alcohol refers to attribute_name = 'Alcohol' and attribute_value = 'none'\nAmong the Yelp_Businesses in Arizona, how many of them do not provide alcohol?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['list', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Good for Kids', 'Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngood for kids refers to attribute_name = 'Good for Kids' and attribute_value = 'true'\n\nPlease list the business IDs of all the Yelp_Businesses that are good for kids.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.business_id FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T1.attribute_name LIKE 'Good for Kids' AND T2.attribute_value LIKE 'TRUE'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T2.business_id FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T1.attribute_name LIKE 'Good for Kids' AND T2.attribute_value LIKE 'TRUE'", "index": 1880, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['list', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Good for Kids', 'Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngood for kids refers to attribute_name = 'Good for Kids' and attribute_value = 'true'\n\nPlease list the business IDs of all the Yelp_Businesses that are good for kids.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Food', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['list', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nunder the category \"Food\" refers to category_name = 'Food'\nPlease list the business ID of the Yelp_Business with the highest Elitestar rating under the category \"Food\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.business_id FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.category_name LIKE 'Food' ORDER BY T3.stars DESC LIMIT 1", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T2.business_id FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.category_name LIKE 'Food' ORDER BY T3.stars DESC LIMIT 1", "index": 1881, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Food', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['list', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nunder the category \"Food\" refers to category_name = 'Food'\nPlease list the business ID of the Yelp_Business with the highest Elitestar rating under the category \"Food\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['list', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_useful text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_funny text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncategories refers to category_name; in Arizona refers to state = 'AZ'\nPlease list all the categories of the Yelp_Business in Arizona.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.category_name FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T3.state LIKE 'AZ' GROUP BY T1.category_name", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T1.category_name FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T3.state LIKE 'AZ' GROUP BY T1.category_name", "index": 1882, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['list', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_useful text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_funny text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncategories refers to category_name; in Arizona refers to state = 'AZ'\nPlease list all the categories of the Yelp_Business in Arizona.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Monday', 'Sunday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Shopping', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlongest business time refers to max(subtract(closing_time, opening_time)); on Mondays refers to day_of_week = 'Monday';  category \"Shopping\" refers to category_name = 'Shopping'\nWhat is the longest business time on Mondays for a Yelp_Business under the category \"Shopping\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.closing_time + 12 - T1.opening_time AS \"hour\" FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id INNER JOIN Business AS T3 ON T1.business_id = T3.business_id INNER JOIN Business_Categories AS T4 ON T3.business_id = T4.business_id INNER JOIN Categories AS T5 ON T4.category_id = T5.category_id WHERE T2.day_of_week LIKE 'Monday' AND T5.category_name LIKE 'Shopping' ORDER BY T1.closing_time + 12 - T1.opening_time DESC LIMIT 1", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T1.closing_time + 12 - T1.opening_time AS \"hour\" FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id INNER JOIN Business AS T3 ON T1.business_id = T3.business_id INNER JOIN Business_Categories AS T4 ON T3.business_id = T4.business_id INNER JOIN Categories AS T5 ON T4.category_id = T5.category_id WHERE T2.day_of_week LIKE 'Monday' AND T5.category_name LIKE 'Shopping' ORDER BY T1.closing_time + 12 - T1.opening_time DESC LIMIT 1", "index": 1883, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Monday', 'Sunday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Shopping', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlongest business time refers to max(subtract(closing_time, opening_time)); on Mondays refers to day_of_week = 'Monday';  category \"Shopping\" refers to category_name = 'Shopping'\nWhat is the longest business time on Mondays for a Yelp_Business under the category \"Shopping\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['list', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusiness time of longer than 12 hours refers to subtract(closing_time, opening_time) > 12; on Sundays refers to day_of_week = 'Sunday'\nPlease list the business IDs of the Yelp_Business that have a business time of longer than 12 hours on Sundays.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.business_id FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id INNER JOIN Business AS T3 ON T1.business_id = T3.business_id WHERE T1.closing_time + 12 - T1.opening_time > 12 AND T2.day_of_week LIKE 'Sunday' GROUP BY T1.business_id", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T1.business_id FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id INNER JOIN Business AS T3 ON T1.business_id = T3.business_id WHERE T1.closing_time + 12 - T1.opening_time > 12 AND T2.day_of_week LIKE 'Sunday' GROUP BY T1.business_id", "index": 1884, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['list', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusiness time of longer than 12 hours refers to subtract(closing_time, opening_time) > 12; on Sundays refers to day_of_week = 'Sunday'\nPlease list the business IDs of the Yelp_Business that have a business time of longer than 12 hours on Sundays.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['more', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nposted more than 10 reviews refers to count(Reviews.user_id) > 10\nAmong the users who have posted more than 10 reviews, how many users are elite users?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(T4.user_id) FROM ( SELECT T1.user_id FROM Users AS T1 INNER JOIN Elite AS T2 ON T1.user_id = T2.user_id INNER JOIN Reviews AS T3 ON T1.user_id = T3.user_id WHERE T3.user_id IS NOT NULL GROUP BY T3.user_id HAVING COUNT(T3.user_id) > 10 ) T4", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(T4.user_id) FROM ( SELECT T1.user_id FROM Users AS T1 INNER JOIN Elite AS T2 ON T1.user_id = T2.user_id INNER JOIN Reviews AS T3 ON T1.user_id = T3.user_id WHERE T3.user_id IS NOT NULL GROUP BY T3.user_id HAVING COUNT(T3.user_id) > 10 ) T4", "index": 1885, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['more', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nposted more than 10 reviews refers to count(Reviews.user_id) > 10\nAmong the users who have posted more than 10 reviews, how many users are elite users?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Anthem', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin Anthem refers to city = 'Anthem'; stars on average = avg(review_stars)\nHow many stars on average does a Yelp_Business in Anthem get from a user review?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT AVG(T2.review_stars) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.city LIKE 'Anthem'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT AVG(T2.review_stars) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.city LIKE 'Anthem'", "index": 1886, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Anthem', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin Anthem refers to city = 'Anthem'; stars on average = avg(review_stars)\nHow many stars on average does a Yelp_Business in Anthem get from a user review?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['average', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nuser no.3 refers to user_id = 3; in Arizona refers to state = 'AZ'; stars on average = avg(review_stars(user_id = 3))\nHow many stars on average does user no.3 give to Yelp_Business in Arizona?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT AVG(T2.review_stars) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.state LIKE 'AZ' AND T2.user_id = 3", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT AVG(T2.review_stars) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.state LIKE 'AZ' AND T2.user_id = 3", "index": 1887, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['average', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nuser no.3 refers to user_id = 3; in Arizona refers to state = 'AZ'; stars on average = avg(review_stars(user_id = 3))\nHow many stars on average does user no.3 give to Yelp_Business in Arizona?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n closing_time text, -- example: ['12PM', '8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['average', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage Elitestar rating refers to DIVIDE(SUM(stars), COUNT(business_id)); closes at 12PM refers to closing_time = '12PM'; on Sundays refers to day_of_week = 'Sunday'\nWhat is the average Elitestar rating for a Yelp_Business that closes at 12PM on Sundays?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(T3.stars) AS REAL) / COUNT(T1.business_id) AS \"average stars\" FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id INNER JOIN Business AS T3 ON T1.business_id = T3.business_id WHERE T2.day_of_week LIKE 'Sunday' AND T1.closing_time LIKE '12PM'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT CAST(SUM(T3.stars) AS REAL) / COUNT(T1.business_id) AS \"average stars\" FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id INNER JOIN Business AS T3 ON T1.business_id = T3.business_id WHERE T2.day_of_week LIKE 'Sunday' AND T1.closing_time LIKE '12PM'", "index": 1888, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n closing_time text, -- example: ['12PM', '8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['average', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage Elitestar rating refers to DIVIDE(SUM(stars), COUNT(business_id)); closes at 12PM refers to closing_time = '12PM'; on Sundays refers to day_of_week = 'Sunday'\nWhat is the average Elitestar rating for a Yelp_Business that closes at 12PM on Sundays?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_useful text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_3 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['Low', 'None']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['Low', 'None']\n label_time_15 text, -- example: ['Low', 'None']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_19 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive businesses refers to active = 'true'; in AZ refers to state = 'AZ'\n\nWhat is the total number of active businesses in AZ with a low review count?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(business_id) FROM Business WHERE state LIKE 'AZ' AND active LIKE 'True' AND review_count LIKE 'low'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(business_id) FROM Business WHERE state LIKE 'AZ' AND active LIKE 'True' AND review_count LIKE 'low'", "index": 1889, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_useful text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_3 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['Low', 'None']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['Low', 'None']\n label_time_15 text, -- example: ['Low', 'None']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_19 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive businesses refers to active = 'true'; in AZ refers to state = 'AZ'\n\nWhat is the total number of active businesses in AZ with a low review count?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Chandler', 'chandler', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_2 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['Low', 'None']\n label_time_14 text, -- example: ['Low', 'None']\n label_time_16 text, -- example: ['Low', 'None']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_useful text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin Chandler refers to city = 'Chandler'; attribute refers to attribute_name\nAmong the businesses in Chandler, list the attribute of the business with a low review count.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT T3.attribute_id, T3.attribute_name FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.attribute_id INNER JOIN Attributes AS T3 ON T2.attribute_id = T3.attribute_id WHERE T1.review_count = 'Low' AND T1.city = 'Chandler'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT DISTINCT T3.attribute_id, T3.attribute_name FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.attribute_id INNER JOIN Attributes AS T3 ON T2.attribute_id = T3.attribute_id WHERE T1.review_count = 'Low' AND T1.city = 'Chandler'", "index": 1890, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Chandler', 'chandler', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_2 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['Low', 'None']\n label_time_14 text, -- example: ['Low', 'None']\n label_time_16 text, -- example: ['Low', 'None']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_useful text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin Chandler refers to city = 'Chandler'; attribute refers to attribute_name\nAmong the businesses in Chandler, list the attribute of the business with a low review count.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Mexican', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncategory of mexican refers to category_name = 'Mexican'; star rating below 4 refers to stars < 4\nIn businesses with a category of mexican, how many of them has a star rating below 4?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.stars < 4 AND T3.category_name LIKE 'Mexican'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.stars < 4 AND T3.category_name LIKE 'Mexican'", "index": 1891, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Mexican', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncategory of mexican refers to category_name = 'Mexican'; star rating below 4 refers to stars < 4\nIn businesses with a category of mexican, how many of them has a star rating below 4?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Fashion', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_18 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive business refers to active = 'true'; category of Fashion refers to category = 'Fashion'\nList the active business ID and its stars of the businesses fall under the category of Fashion.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.business_id, T1.stars FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.active LIKE 'TRUE' AND T3.category_name LIKE 'Fashion'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T1.business_id, T1.stars FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.active LIKE 'TRUE' AND T3.category_name LIKE 'Fashion'", "index": 1892, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Fashion', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_18 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive business refers to active = 'true'; category of Fashion refers to category = 'Fashion'\nList the active business ID and its stars of the businesses fall under the category of Fashion.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Caters', 'Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_15 text, -- example: ['Low', 'None']\n label_time_16 text, -- example: ['Low', 'None']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive businesses refers to active = 'true'; attribute of caters refers to attribute_name = 'Caters'\nCount the active businesses that has an attribute of caters with low review count.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.business_id) FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id INNER JOIN Attributes AS T3 ON T2.attribute_id = T3.attribute_id WHERE T3.attribute_name LIKE 'Caters' AND T1.review_count LIKE 'Low' AND T1.active LIKE 'TRUE'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id INNER JOIN Attributes AS T3 ON T2.attribute_id = T3.attribute_id WHERE T3.attribute_name LIKE 'Caters' AND T1.review_count LIKE 'Low' AND T1.active LIKE 'TRUE'", "index": 1893, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Caters', 'Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_15 text, -- example: ['Low', 'None']\n label_time_16 text, -- example: ['Low', 'None']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive businesses refers to active = 'true'; attribute of caters refers to attribute_name = 'Caters'\nCount the active businesses that has an attribute of caters with low review count.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Tempe', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlocated at Tempe refers to city = 'Tempe'; highest star rating refers to max(stars)\nWhat is the closing and opening time of businesses located at Tempe with highest star rating?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.closing_time, T2.opening_time FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T1.city LIKE 'Tempe' ORDER BY T1.stars DESC LIMIT 1", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T2.closing_time, T2.opening_time FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T1.city LIKE 'Tempe' ORDER BY T1.stars DESC LIMIT 1", "index": 1894, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Tempe', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlocated at Tempe refers to city = 'Tempe'; highest star rating refers to max(stars)\nWhat is the closing and opening time of businesses located at Tempe with highest star rating?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['list', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Surprise', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_funny text, -- example: ['Low', 'None']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncategories refers to category_name; active businesses refers to active = 'true'; in Surprise, AZ refers to city = 'Surprise' and state = 'AZ'\nList the categories of active businesses in Surprise, AZ.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.category_name FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.active LIKE 'TRUE' AND T1.state LIKE 'AZ' AND T1.city LIKE 'Surprise' GROUP BY T3.category_name", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T3.category_name FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.active LIKE 'TRUE' AND T1.state LIKE 'AZ' AND T1.city LIKE 'Surprise' GROUP BY T3.category_name", "index": 1895, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['list', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Surprise', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_funny text, -- example: ['Low', 'None']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncategories refers to category_name; active businesses refers to active = 'true'; in Surprise, AZ refers to city = 'Surprise' and state = 'AZ'\nList the categories of active businesses in Surprise, AZ.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['Medium', 'None', 'Low']\n label_time_15 text, -- example: ['Medium', 'None', 'Low']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Chandler', 'chandler', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['Medium', 'Low']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive businesses refers to active = 'true'; in Chandler refers to city = 'Chandler'\nWhat is the opening time of the active businesses in Chandler that has a medium review count.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.opening_time FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T1.city LIKE 'Chandler' AND T1.active LIKE 'TRUE' AND T1.review_count LIKE 'Medium'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT DISTINCT T2.opening_time FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T1.city LIKE 'Chandler' AND T1.active LIKE 'TRUE' AND T1.review_count LIKE 'Medium'", "index": 1896, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['Medium', 'None', 'Low']\n label_time_15 text, -- example: ['Medium', 'None', 'Low']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Chandler', 'chandler', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['Medium', 'Low']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive businesses refers to active = 'true'; in Chandler refers to city = 'Chandler'\nWhat is the opening time of the active businesses in Chandler that has a medium review count.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['High', 'Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_17 text, -- example: ['Low', 'None']\n label_time_21 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhigh review count refers to review_count = 'High'\nHow many businesses are with high review count?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(business_id) FROM Business WHERE review_count LIKE 'High'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(business_id) FROM Business WHERE review_count LIKE 'High'", "index": 1897, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['High', 'Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_17 text, -- example: ['Low', 'None']\n label_time_21 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhigh review count refers to review_count = 'High'\nHow many businesses are with high review count?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['beer_and_wine', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nattribute_value = 'beer_and_wine'\nHow many businesses ID sell beer and wine?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(business_id) FROM Business_Attributes WHERE attribute_id = 1 AND attribute_value = 'beer_and_wine'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(business_id) FROM Business_Attributes WHERE attribute_id = 1 AND attribute_value = 'beer_and_wine'", "index": 1898, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['beer_and_wine', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nattribute_value = 'beer_and_wine'\nHow many businesses ID sell beer and wine?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_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 attributes ID owned by business ID 2?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(attribute_id) FROM Business_Attributes WHERE business_id = 2", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(attribute_id) FROM Business_Attributes WHERE business_id = 2", "index": 1899, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_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 attributes ID owned by business ID 2?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }