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 awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n won integer, -- example: [14, 13]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n lastseason integer, -- example: [0, 1951]\n weight integer, -- example: [240, 225]\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['birthCountry', 'USA', 'EGY']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['NJ', 'NY']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GS integer, -- game starting, example: [0, 69]\n points integer, -- example: [135, 432]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n assists integer, -- assistants, example: [12, 30]\n turnovers integer, -- example: [22, 66]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n threeMade integer, -- three point made, example: [0, 1]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n points integer, -- example: [10, 19]\n rebounds integer, -- example: [11, 14]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 1975 refers to season_id = 1975; coming from USA refers to birthCountry = 'USA'; average point refers to Divide (Sum(points), Count(playerID))\nIn 1975, what was the average point of all-star players coming from the USA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.points) FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T2.season_id = 1975", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT AVG(T2.points) FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T2.season_id = 1975", "index": 1400, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n won integer, -- example: [14, 13]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n lastseason integer, -- example: [0, 1951]\n weight integer, -- example: [240, 225]\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['birthCountry', 'USA', 'EGY']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['NJ', 'NY']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GS integer, -- game starting, example: [0, 69]\n points integer, -- example: [135, 432]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n assists integer, -- assistants, example: [12, 30]\n turnovers integer, -- example: [22, 66]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n threeMade integer, -- three point made, example: [0, 1]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n points integer, -- example: [10, 19]\n rebounds integer, -- example: [11, 14]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 1975 refers to season_id = 1975; coming from USA refers to birthCountry = 'USA'; average point refers to Divide (Sum(points), Count(playerID))\nIn 1975, what was the average point of all-star players coming from the USA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GS integer, -- game starting, example: [0, 69]\n blocks integer, -- example: [12, 17]\n PF integer, -- personal fouls, example: [39, 132]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n rebounds integer, -- example: [11, 14]\n turnovers integer, -- example: [1, 0]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameSuffix text, -- example: ['Jr.', 'III']\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n birthCity text, -- example: ['Cairo', 'New York']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhigher than 75 inch refers to height > 75\nPlease list the last names and first names of all-star players who are higher than 75 inch.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.lastName, T1.firstName FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.height > 75", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT DISTINCT T1.lastName, T1.firstName FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.height > 75", "index": 1401, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GS integer, -- game starting, example: [0, 69]\n blocks integer, -- example: [12, 17]\n PF integer, -- personal fouls, example: [39, 132]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n rebounds integer, -- example: [11, 14]\n turnovers integer, -- example: [1, 0]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameSuffix text, -- example: ['Jr.', 'III']\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n birthCity text, -- example: ['Cairo', 'New York']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhigher than 75 inch refers to height > 75\nPlease list the last names and first names of all-star players who are higher than 75 inch.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['MIN', 'AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n awayWon integer, -- away wins, example: [5, 1]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['MIN', 'POR', 'GSW']\n stint integer, -- example: [2, 1]\n post_wins integer, -- post season wins, example: [0, 12]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['MIN', 'PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['MIN', 'CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['MIN', 'POR', 'MIL']\n PF integer, -- personal fouls, example: [39, 132]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['MIN', 'ANA', 'DNR']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n weight integer, -- example: [240, 225]\n college text, -- example: ['college', 'UCLA', 'Duke']\n birthCountry text, -- example: ['EGY', 'USA']\n hsState text, -- high school state, example: ['NJ', 'NY']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nminimum weight refers to Min(weight)\nWhat is the minimum weight of all-star players coming from UCLA 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 MIN(T1.weight) FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.college = 'UCLA'", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT MIN(T1.weight) FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.college = 'UCLA'", "index": 1402, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['MIN', 'AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n awayWon integer, -- away wins, example: [5, 1]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['MIN', 'POR', 'GSW']\n stint integer, -- example: [2, 1]\n post_wins integer, -- post season wins, example: [0, 12]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['MIN', 'PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['MIN', 'CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['MIN', 'POR', 'MIL']\n PF integer, -- personal fouls, example: [39, 132]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['MIN', 'ANA', 'DNR']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n weight integer, -- example: [240, 225]\n college text, -- example: ['college', 'UCLA', 'Duke']\n birthCountry text, -- example: ['EGY', 'USA']\n hsState text, -- high school state, example: ['NJ', 'NY']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nminimum weight refers to Min(weight)\nWhat is the minimum weight of all-star players coming from UCLA 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 series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n games_played integer, -- example: [1]\n points integer, -- example: [10, 19]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n steals integer, -- example: [3, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n birthDate date, -- example: ['0000-00-00', '1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n confRank integer, -- example: [0, 4]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n d_pts integer, -- defense points, example: [578, 498]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom 1960 to 1970 refers to season_id between 1960 and 1970; still alive refers to deathDate = '0000-00-00'\nFrom 1960 to 1970, what is the total point of all-star players who are still alive?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.points) FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T2.season_id BETWEEN 1960 AND 1970 AND T1.deathDate = '0000-00-00'", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT SUM(T2.points) FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T2.season_id BETWEEN 1960 AND 1970 AND T1.deathDate = '0000-00-00'", "index": 1403, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n games_played integer, -- example: [1]\n points integer, -- example: [10, 19]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n steals integer, -- example: [3, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n birthDate date, -- example: ['0000-00-00', '1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n confRank integer, -- example: [0, 4]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n d_pts integer, -- defense points, example: [578, 498]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom 1960 to 1970 refers to season_id between 1960 and 1970; still alive refers to deathDate = '0000-00-00'\nFrom 1960 to 1970, what is the total point of all-star players who are still alive?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['NJ', 'NY']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteam with at least 3 all star player refers to tmID where Count(player_allstar.playerID) > = 3\nPlease list the team names which have at least 3 all-star players.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.tmID FROM players_teams AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID GROUP BY T1.tmID HAVING COUNT(DISTINCT T1.playerID) >= 3", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT T1.tmID FROM players_teams AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID GROUP BY T1.tmID HAVING COUNT(DISTINCT T1.playerID) >= 3", "index": 1404, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['NJ', 'NY']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteam with at least 3 all star player refers to tmID where Count(player_allstar.playerID) > = 3\nPlease list the team names which have at least 3 all-star players.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n lastName text, -- example: ['Rank', 'Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Max', 'Alaa', 'Kareem']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n lastName text, -- example: ['Rank', 'Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Max', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Max', 'Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom 1950 to 1970 refers to year between 1950 and 1970; team with rank 1 refers to rank = 1; maximum point refers to Max(points)\nFrom 1950 to 1970, what is the maximum point of players whose teams were ranked 1?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT MAX(T2.points) FROM teams AS T1 INNER JOIN players_teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.year BETWEEN 1950 AND 1970 AND T1.rank = 1", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT MAX(T2.points) FROM teams AS T1 INNER JOIN players_teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.year BETWEEN 1950 AND 1970 AND T1.rank = 1", "index": 1405, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n lastName text, -- example: ['Rank', 'Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Max', 'Alaa', 'Kareem']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n lastName text, -- example: ['Rank', 'Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Max', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Max', 'Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom 1950 to 1970 refers to year between 1950 and 1970; team with rank 1 refers to rank = 1; maximum point refers to Max(points)\nFrom 1950 to 1970, what is the maximum point of players whose teams were ranked 1?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Max', 'Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Max', 'Alaa', 'Kareem']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameNick text, -- nick name, example: ['Max', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['West Point', 'Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n highSchool text, -- example: ['West Point', 'Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n lastName text, -- example: ['Rank', 'Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom 1937 to 1940 refers to year between 1937 and 1940; player with highest point refers to Max(points)\nAmong the teams that were ranked 3 from 1937 to 1940, what is the team name whose players had the highest point?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT T1.name FROM teams AS T1 INNER JOIN players_teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.rank = 3 AND T1.year BETWEEN 1937 AND 1940 ORDER BY T2.points DESC LIMIT 1", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT DISTINCT T1.name FROM teams AS T1 INNER JOIN players_teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.rank = 3 AND T1.year BETWEEN 1937 AND 1940 ORDER BY T2.points DESC LIMIT 1", "index": 1406, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Max', 'Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Max', 'Alaa', 'Kareem']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameNick text, -- nick name, example: ['Max', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['West Point', 'Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n highSchool text, -- example: ['West Point', 'Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n lastName text, -- example: ['Rank', 'Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom 1937 to 1940 refers to year between 1937 and 1940; player with highest point refers to Max(points)\nAmong the teams that were ranked 3 from 1937 to 1940, what is the team name whose players had the highest point?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['George', 'Mikan', 'Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['George', 'Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n assists integer, -- assistants, example: [4, 1]\n turnovers integer, -- example: [1, 0]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['George', 'Alaa', 'Kareem']\n middleName text, -- example: ['George', 'Shareef', 'Craig']\n lastName text, -- example: ['George', 'Mikan', 'Abdelnaby', 'Abdul-Jabbar']\n nameSuffix text, -- example: ['Jr.', 'III']\n firstseason integer, -- example: [0, 1951]\n weight integer, -- example: [240, 225]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthState text, -- example: ['NY', 'DE']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n d_pts integer, -- defense points, example: [578, 498]\n awayWon integer, -- away wins, example: [5, 1]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n oRebounds integer, -- offense rebounds, example: [27, 81]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbetween 1951 and 1953 refers to season_id; field goal refers to fg_made\nHow many field goals did George Mikan make overall between 1951 and 1953?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(fg_made) FROM player_allstar WHERE first_name = 'George' AND last_name = 'Mikan' AND season_id BETWEEN 1951 AND 1953", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT COUNT(fg_made) FROM player_allstar WHERE first_name = 'George' AND last_name = 'Mikan' AND season_id BETWEEN 1951 AND 1953", "index": 1407, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['George', 'Mikan', 'Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['George', 'Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n assists integer, -- assistants, example: [4, 1]\n turnovers integer, -- example: [1, 0]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['George', 'Alaa', 'Kareem']\n middleName text, -- example: ['George', 'Shareef', 'Craig']\n lastName text, -- example: ['George', 'Mikan', 'Abdelnaby', 'Abdul-Jabbar']\n nameSuffix text, -- example: ['Jr.', 'III']\n firstseason integer, -- example: [0, 1951]\n weight integer, -- example: [240, 225]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthState text, -- example: ['NY', 'DE']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n d_pts integer, -- defense points, example: [578, 498]\n awayWon integer, -- away wins, example: [5, 1]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n oRebounds integer, -- offense rebounds, example: [27, 81]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbetween 1951 and 1953 refers to season_id; field goal refers to fg_made\nHow many field goals did George Mikan make overall between 1951 and 1953?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n blocks integer, -- example: [2, 0]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n assists integer, -- assistants, example: [12, 30]\n PF integer, -- personal fouls, example: [39, 132]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n pos text, -- position, example: ['F-C', 'C']\n weight integer, -- example: [240, 225]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n suffixName text, -- example: ['Jr.']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest home lost rate = Max(Divide(homelost, Sum(homeWon, homeLost)))\nWhat is the name of the team with the highest home lost rate?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT name FROM teams ORDER BY CAST(homeWon AS REAL) / (homeWon + homeLost) DESC LIMIT 1", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT name FROM teams ORDER BY CAST(homeWon AS REAL) / (homeWon + homeLost) DESC LIMIT 1", "index": 1408, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n blocks integer, -- example: [2, 0]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n assists integer, -- assistants, example: [12, 30]\n PF integer, -- personal fouls, example: [39, 132]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n pos text, -- position, example: ['F-C', 'C']\n weight integer, -- example: [240, 225]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n suffixName text, -- example: ['Jr.']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest home lost rate = Max(Divide(homelost, Sum(homeWon, homeLost)))\nWhat is the name of the team with the highest home lost rate?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Max', 'Alaa', 'Kareem']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Max', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npass away refers to deathDate ! = 'null'; most award refers to playerID where Max(Count(award))\nAmong the players who have passed away, who had the most award?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.playerID FROM players AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID WHERE deathDate IS NOT NULL GROUP BY T1.playerID ORDER BY COUNT(award) DESC LIMIT 1", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT T1.playerID FROM players AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID WHERE deathDate IS NOT NULL GROUP BY T1.playerID ORDER BY COUNT(award) DESC LIMIT 1", "index": 1409, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Max', 'Alaa', 'Kareem']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Max', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npass away refers to deathDate ! = 'null'; most award refers to playerID where Max(Count(award))\nAmong the players who have passed away, who had the most award?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['ABA', 'NBA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['ABA', 'NBA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['ABA', 'NBA', 'NBL']\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['ABA', 'NBA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Max', 'Win', 'Alaa', 'Kareem']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Max', 'Lew, Cap', 'Walt']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['ABA', 'NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n rank integer, -- example: [1, 2]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Win', 'Darrell', 'Bob']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Max', 'Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n league_id text, -- example: ['ABA', 'NBA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n steals integer, -- example: [3, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"ABA\" is the lgID; from 1972 to 1973 refers to year = 1972 and year = 1973; team with the fastest growth in winning rate = Max(Subtract(Divide(won where year = 1973, Sum(won, lost)),Divide(won where year = 1972, Sum(won, lost))))\nWhat is the full name of the team with the fastest growth in winning rate in the 'ABA' league from 1972 to 1973?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.name FROM teams AS T1 INNER JOIN ( SELECT * FROM teams WHERE lgID = 'ABA' AND year = 1972 ) AS T2 ON T1.tmID = T2.tmID WHERE T1.lgID = 'ABA' AND T1.year = 1973 ORDER BY (CAST(T1.won AS REAL) / (T1.won + T1.lost) - (CAST(T2.won AS REAL) / (T2.won + T2.lost))) DESC LIMIT 1", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT T1.name FROM teams AS T1 INNER JOIN ( SELECT * FROM teams WHERE lgID = 'ABA' AND year = 1972 ) AS T2 ON T1.tmID = T2.tmID WHERE T1.lgID = 'ABA' AND T1.year = 1973 ORDER BY (CAST(T1.won AS REAL) / (T1.won + T1.lost) - (CAST(T2.won AS REAL) / (T2.won + T2.lost))) DESC LIMIT 1", "index": 1410, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['ABA', 'NBA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['ABA', 'NBA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['ABA', 'NBA', 'NBL']\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['ABA', 'NBA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Max', 'Win', 'Alaa', 'Kareem']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Max', 'Lew, Cap', 'Walt']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['ABA', 'NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n rank integer, -- example: [1, 2]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Win', 'Darrell', 'Bob']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Max', 'Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n league_id text, -- example: ['ABA', 'NBA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n steals integer, -- example: [3, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"ABA\" is the lgID; from 1972 to 1973 refers to year = 1972 and year = 1973; team with the fastest growth in winning rate = Max(Subtract(Divide(won where year = 1973, Sum(won, lost)),Divide(won where year = 1972, Sum(won, lost))))\nWhat is the full name of the team with the fastest growth in winning rate in the 'ABA' league from 1972 to 1973?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n turnovers integer, -- example: [1, 0]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['ABA', 'NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n homeLost integer, -- home loses, example: [1, 2]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['ABA Coach of the Year', 'NBA Coach of the Year']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n suffixName text, -- example: ['Jr.']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n lastseason integer, -- example: [0, 1951]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['NJ', 'NY']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n assists integer, -- assistants, example: [12, 30]\n turnovers integer, -- example: [22, 66]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"ABA Coach of the Year\" is the award; highest number of won games refers to Max(Count(won))\nAmong the coaches who won the 'ABA Coach of the Year' award, which is the coach with the highest number of won games?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.coachID FROM coaches AS T1 INNER JOIN awards_coaches AS T2 ON T1.coachID = T2.coachID WHERE T2.award = 'ABA Coach of the Year' GROUP BY T1.coachID, T1.won ORDER BY T1.won DESC LIMIT 1", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT T1.coachID FROM coaches AS T1 INNER JOIN awards_coaches AS T2 ON T1.coachID = T2.coachID WHERE T2.award = 'ABA Coach of the Year' GROUP BY T1.coachID, T1.won ORDER BY T1.won DESC LIMIT 1", "index": 1411, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n turnovers integer, -- example: [1, 0]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['ABA', 'NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n homeLost integer, -- home loses, example: [1, 2]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['ABA Coach of the Year', 'NBA Coach of the Year']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n suffixName text, -- example: ['Jr.']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n lastseason integer, -- example: [0, 1951]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['NJ', 'NY']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n assists integer, -- assistants, example: [12, 30]\n turnovers integer, -- example: [22, 66]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"ABA Coach of the Year\" is the award; highest number of won games refers to Max(Count(won))\nAmong the coaches who won the 'ABA Coach of the Year' award, which is the coach with the highest number of won games?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Max', 'Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n lastseason integer, -- example: [0, 1951]\n college text, -- example: ['Duke', 'UCLA']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthCountry text, -- example: ['EGY', 'USA']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 1973 refers to year = 1973; player with highest field goal made refers to Max(Divide(fgMade, fgAttempted))\nWhat is the first and last name of the player with the highest field goal made rate in 1973?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.firstName, T1.lastName FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE year = 1973 ORDER BY CAST(T2.fgMade AS REAL) / T2.fgAttempted DESC LIMIT 1", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT T1.firstName, T1.lastName FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE year = 1973 ORDER BY CAST(T2.fgMade AS REAL) / T2.fgAttempted DESC LIMIT 1", "index": 1412, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Max', 'Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n lastseason integer, -- example: [0, 1951]\n college text, -- example: ['Duke', 'UCLA']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthCountry text, -- example: ['EGY', 'USA']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 1973 refers to year = 1973; player with highest field goal made refers to Max(Divide(fgMade, fgAttempted))\nWhat is the first and last name of the player with the highest field goal made rate in 1973?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_made integer, -- free throw made, example: [2, 3]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Lynn', 'Mike', 'Darrell', 'Bob']\n lastName text, -- example: ['Lynn', 'Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n PF integer, -- personal fouls, example: [39, 132]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostPoints integer, -- post season points, example: [4, 12]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n lost integer, -- example: [4, 5]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Mike', 'Alaa', 'Kareem']\n firstName text, -- example: ['Lynn', 'Mike', 'Alaa', 'Kareem']\n middleName text, -- example: ['Lynn', 'Shareef', 'Craig']\n lastName text, -- example: ['Lynn', 'Abdelnaby', 'Abdul-Jabbar']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lynn', 'Mike', 'Lew, Cap', 'Walt']\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to teams.name\nWhat is the full name of the team that selected Mike Lynn?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.name FROM teams AS T1 INNER JOIN draft AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.draftYear WHERE T2.firstName = 'Mike' AND T2.lastName = 'Lynn'", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT T1.name FROM teams AS T1 INNER JOIN draft AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.draftYear WHERE T2.firstName = 'Mike' AND T2.lastName = 'Lynn'", "index": 1413, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_made integer, -- free throw made, example: [2, 3]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Lynn', 'Mike', 'Darrell', 'Bob']\n lastName text, -- example: ['Lynn', 'Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n PF integer, -- personal fouls, example: [39, 132]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostPoints integer, -- post season points, example: [4, 12]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n lost integer, -- example: [4, 5]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Mike', 'Alaa', 'Kareem']\n firstName text, -- example: ['Lynn', 'Mike', 'Alaa', 'Kareem']\n middleName text, -- example: ['Lynn', 'Shareef', 'Craig']\n lastName text, -- example: ['Lynn', 'Abdelnaby', 'Abdul-Jabbar']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lynn', 'Mike', 'Lew, Cap', 'Walt']\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to teams.name\nWhat is the full name of the team that selected Mike Lynn?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['birthCountry', 'USA', 'EGY']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n steals integer, -- example: [3, 0]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n rank integer, -- example: [1, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n lost integer, -- example: [4, 5]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['Most Improved Player', 'All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n blocks integer, -- example: [12, 17]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftMade integer, -- free throw made, example: [25, 76]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe Most improved Player refers to award = 'Most Improved Player'; from 1985-1990 refers to year between 1985 and 1990; country is USA refers to birthCountry = 'USA'\nAmong the Most improved Players awarded from 1985-1990, how many player whose country is USA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(DISTINCT T2.playerID) FROM awards_players AS T1 INNER JOIN players AS T2 ON T1.playerID = T2.playerID WHERE T1.award = 'Most Improved Player' AND T2.birthCountry = 'USA' AND T1.year BETWEEN 1985 AND 1990", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T2.playerID) FROM awards_players AS T1 INNER JOIN players AS T2 ON T1.playerID = T2.playerID WHERE T1.award = 'Most Improved Player' AND T2.birthCountry = 'USA' AND T1.year BETWEEN 1985 AND 1990", "index": 1414, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['birthCountry', 'USA', 'EGY']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n steals integer, -- example: [3, 0]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n rank integer, -- example: [1, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n lost integer, -- example: [4, 5]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['Most Improved Player', 'All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n blocks integer, -- example: [12, 17]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftMade integer, -- free throw made, example: [25, 76]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe Most improved Player refers to award = 'Most Improved Player'; from 1985-1990 refers to year between 1985 and 1990; country is USA refers to birthCountry = 'USA'\nAmong the Most improved Players awarded from 1985-1990, how many player whose country is USA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n playoff text, -- example: ['CF', 'WC']\n homeLost integer, -- home loses, example: [1, 2]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['Most Valuable Player', 'All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n league_id text, -- example: ['NBA', 'ABA']\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n rebounds integer, -- example: [89, 260]\n steals integer, -- example: [4, 25]\n threeMade integer, -- three point made, example: [0, 1]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n middleName text, -- example: ['Shareef', 'Craig']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMost Valuable Player award refers to award = 'Most Valuable Player'; from 1969 to 1975 refers to year between 1969 and 1975\nHow many players received Most Valuable Player award from 1969 to 1975?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(DISTINCT playerID) FROM awards_players WHERE year BETWEEN 1969 AND 1975 AND award = 'Most Valuable Player'", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT COUNT(DISTINCT playerID) FROM awards_players WHERE year BETWEEN 1969 AND 1975 AND award = 'Most Valuable Player'", "index": 1415, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n playoff text, -- example: ['CF', 'WC']\n homeLost integer, -- home loses, example: [1, 2]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['Most Valuable Player', 'All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n league_id text, -- example: ['NBA', 'ABA']\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n rebounds integer, -- example: [89, 260]\n steals integer, -- example: [4, 25]\n threeMade integer, -- three point made, example: [0, 1]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n middleName text, -- example: ['Shareef', 'Craig']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMost Valuable Player award refers to award = 'Most Valuable Player'; from 1969 to 1975 refers to year between 1969 and 1975\nHow many players received Most Valuable Player award from 1969 to 1975?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n points integer, -- example: [10, 19]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthState text, -- example: ['birthState', 'NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteam name refers to teams.name; state that a player is born refers to birthState\nPlease list the team names which have at least 5 players were born in the same 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 DISTINCT name FROM teams WHERE tmID IN ( SELECT tmID FROM players_teams AS T1 INNER JOIN players AS T2 ON T1.playerID = T2.playerID WHERE T2.birthState IS NOT NULL GROUP BY T1.tmID, T2.birthState HAVING COUNT(*) > 5 )", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT DISTINCT name FROM teams WHERE tmID IN ( SELECT tmID FROM players_teams AS T1 INNER JOIN players AS T2 ON T1.playerID = T2.playerID WHERE T2.birthState IS NOT NULL GROUP BY T1.tmID, T2.birthState HAVING COUNT(*) > 5 )", "index": 1416, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n points integer, -- example: [10, 19]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthState text, -- example: ['birthState', 'NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteam name refers to teams.name; state that a player is born refers to birthState\nPlease list the team names which have at least 5 players were born in the same 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 players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Ha', 'Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthCity text, -- example: ['Cairo', 'New York']\n birthCountry text, -- example: ['EGY', 'USA']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n awayWon integer, -- away wins, example: [5, 1]\n lost integer, -- example: [4, 5]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n assists integer, -- assistants, example: [4, 1]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n assists integer, -- assistants, example: [12, 30]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNBA refers to lgID = 'NBA'; have at least 3 all-star players refers to count(player_allstar.playerID) > 3\nHow many teams in the NBA which has at least 3 all-star players?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(*) FROM ( SELECT tmID FROM players_teams AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.lgID = 'NBA' GROUP BY T1.tmID HAVING COUNT(DISTINCT T1.playerID) > 3 ) AS T3", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT COUNT(*) FROM ( SELECT tmID FROM players_teams AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.lgID = 'NBA' GROUP BY T1.tmID HAVING COUNT(DISTINCT T1.playerID) > 3 ) AS T3", "index": 1417, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Ha', 'Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthCity text, -- example: ['Cairo', 'New York']\n birthCountry text, -- example: ['EGY', 'USA']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n awayWon integer, -- away wins, example: [5, 1]\n lost integer, -- example: [4, 5]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n assists integer, -- assistants, example: [4, 1]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n assists integer, -- assistants, example: [12, 30]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNBA refers to lgID = 'NBA'; have at least 3 all-star players refers to count(player_allstar.playerID) > 3\nHow many teams in the NBA which has at least 3 all-star players?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n college text, -- example: ['Duke', 'UCLA']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['NJ', 'NY']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n minutes integer, -- example: [290, 934]\n steals integer, -- example: [4, 25]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgMade integer, -- field goal made, example: [55, 178]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostPoints integer, -- post season points, example: [4, 12]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n awayWon integer, -- away wins, example: [5, 1]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 1950 refers to year = 1950; losing rate less than 20% refers to divide(lost, add(won, lost)) < 0.2\nIn 1950, how many players whose teams have the losing rate less than 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(DISTINCT T1.playerID) FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID INNER JOIN teams AS T3 ON T3.tmID = T2.tmID WHERE CAST(T3.lost AS REAL) * 100 / (T3.lost + T3.won) < 20", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T1.playerID) FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID INNER JOIN teams AS T3 ON T3.tmID = T2.tmID WHERE CAST(T3.lost AS REAL) * 100 / (T3.lost + T3.won) < 20", "index": 1418, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n college text, -- example: ['Duke', 'UCLA']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['NJ', 'NY']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n minutes integer, -- example: [290, 934]\n steals integer, -- example: [4, 25]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgMade integer, -- field goal made, example: [55, 178]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostPoints integer, -- post season points, example: [4, 12]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n awayWon integer, -- away wins, example: [5, 1]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 1950 refers to year = 1950; losing rate less than 20% refers to divide(lost, add(won, lost)) < 0.2\nIn 1950, how many players whose teams have the losing rate less than 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 player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n points integer, -- example: [10, 19]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n homeWon integer, -- home wins, example: [8, 2]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['firstName', 'Alaa', 'Kareem']\n middleName text, -- example: ['middleName', 'Shareef', 'Craig']\n lastName text, -- example: ['lastName', 'Abdelnaby', 'Abdul-Jabbar']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n birthCountry text, -- example: ['birthCountry', 'USA', 'EGY']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['NJ', 'NY']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n threeMade integer, -- three point made, example: [0, 1]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Born', 'Hardy', 'Krulish']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to firstName, middleName, lastName; born outside USA refers to birthCountry ! = 'USA'\nList the full name of players who are born outside USA.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT firstName, middleName, lastName FROM players WHERE birthCountry != 'USA'", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT firstName, middleName, lastName FROM players WHERE birthCountry != 'USA'", "index": 1419, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n points integer, -- example: [10, 19]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n homeWon integer, -- home wins, example: [8, 2]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['firstName', 'Alaa', 'Kareem']\n middleName text, -- example: ['middleName', 'Shareef', 'Craig']\n lastName text, -- example: ['lastName', 'Abdelnaby', 'Abdul-Jabbar']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n birthCountry text, -- example: ['birthCountry', 'USA', 'EGY']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['NJ', 'NY']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n threeMade integer, -- three point made, example: [0, 1]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Born', 'Hardy', 'Krulish']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to firstName, middleName, lastName; born outside USA refers to birthCountry ! = 'USA'\nList the full name of players who are born outside USA.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n rebounds integer, -- example: [89, 260]\n ftMade integer, -- free throw made, example: [25, 76]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n o_pts integer, -- offense points, example: [681, 645]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n league_id text, -- example: ['NBA', 'ABA']\n rebounds integer, -- example: [11, 14]\n steals integer, -- example: [3, 0]\n turnovers integer, -- example: [1, 0]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n nameSuffix text, -- example: ['Jr.', 'III']\n firstseason integer, -- example: [0, 1951]\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin year '1988' refers to year = 1988; the most 'won' than 'lost' refers to max(subtract(won, lost))\nWhich coach has the most 'won' than 'lost' in year '1988'?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT coachID FROM coaches WHERE year = 1988 ORDER BY won - lost DESC LIMIT 1", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT coachID FROM coaches WHERE year = 1988 ORDER BY won - lost DESC LIMIT 1", "index": 1420, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n rebounds integer, -- example: [89, 260]\n ftMade integer, -- free throw made, example: [25, 76]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n o_pts integer, -- offense points, example: [681, 645]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n league_id text, -- example: ['NBA', 'ABA']\n rebounds integer, -- example: [11, 14]\n steals integer, -- example: [3, 0]\n turnovers integer, -- example: [1, 0]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n nameSuffix text, -- example: ['Jr.', 'III']\n firstseason integer, -- example: [0, 1951]\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin year '1988' refers to year = 1988; the most 'won' than 'lost' refers to max(subtract(won, lost))\nWhich coach has the most 'won' than 'lost' in year '1988'?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n assists integer, -- assistants, example: [4, 1]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteam name refers to teams.name; won the title 'NBA Coach of the Year' refers to award = 'NBA Coach of the Year'; in 2010 refers to year = 2010\nName the team in which the coach won the title 'NBA Coach of the Year' in 2010.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT T1.tmID FROM coaches AS T1 INNER JOIN awards_coaches AS T2 ON T1.coachID = T2.coachID WHERE T2.year = 2010 AND T2.award = 'NBA Coach of the Year'", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT DISTINCT T1.tmID FROM coaches AS T1 INNER JOIN awards_coaches AS T2 ON T1.coachID = T2.coachID WHERE T2.year = 2010 AND T2.award = 'NBA Coach of the Year'", "index": 1421, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n assists integer, -- assistants, example: [4, 1]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteam name refers to teams.name; won the title 'NBA Coach of the Year' refers to award = 'NBA Coach of the Year'; in 2010 refers to year = 2010\nName the team in which the coach won the title 'NBA Coach of the Year' in 2010.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n pos text, -- position, example: ['F-C', 'C']\n lastseason integer, -- example: [0, 1951]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Seattle', 'Cairo', 'New York']\n hsCity text, -- high school city, example: ['Seattle', 'Bloomfield', 'New York']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Seattle', 'Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_wins integer, -- post season wins, example: [0, 12]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n points integer, -- example: [10, 19]\n rebounds integer, -- example: [11, 14]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n confRank integer, -- example: [0, 4]\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n assists integer, -- assistants, example: [12, 30]\n blocks integer, -- example: [12, 17]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n threeMade integer, -- three point made, example: [0, 1]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteam name refers to teams.name; drafted from 'Seattle' refers to draftFrom = 'Seattle'; between year 1965 to 1970 refers to draftYear between 1965 and 1970\nList the first name, last name and team name of players who are drafted from 'Seattle' between year 1965 to 1970.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT T1.firstName, T1.lastName, T3.name FROM players AS T1 INNER JOIN draft AS T2 ON T1.playerID = T2.playerID INNER JOIN teams AS T3 ON T2.tmID = T3.tmID WHERE T2.draftFrom = 'Seattle' AND T2.draftYear BETWEEN 1965 AND 1970", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT DISTINCT T1.firstName, T1.lastName, T3.name FROM players AS T1 INNER JOIN draft AS T2 ON T1.playerID = T2.playerID INNER JOIN teams AS T3 ON T2.tmID = T3.tmID WHERE T2.draftFrom = 'Seattle' AND T2.draftYear BETWEEN 1965 AND 1970", "index": 1422, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n pos text, -- position, example: ['F-C', 'C']\n lastseason integer, -- example: [0, 1951]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Seattle', 'Cairo', 'New York']\n hsCity text, -- high school city, example: ['Seattle', 'Bloomfield', 'New York']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Seattle', 'Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_wins integer, -- post season wins, example: [0, 12]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n points integer, -- example: [10, 19]\n rebounds integer, -- example: [11, 14]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n confRank integer, -- example: [0, 4]\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n assists integer, -- assistants, example: [12, 30]\n blocks integer, -- example: [12, 17]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n threeMade integer, -- three point made, example: [0, 1]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteam name refers to teams.name; drafted from 'Seattle' refers to draftFrom = 'Seattle'; between year 1965 to 1970 refers to draftYear between 1965 and 1970\nList the first name, last name and team name of players who are drafted from 'Seattle' between year 1965 to 1970.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['Finals MVP', 'Finals MVP ', 'All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['firstName', 'Alaa', 'Kareem']\n middleName text, -- example: ['middleName', 'Shareef', 'Craig']\n lastName text, -- example: ['lastName', 'Abdelnaby', 'Abdul-Jabbar']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthState text, -- example: ['NY', 'DE']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n assists integer, -- assistants, example: [12, 30]\n blocks integer, -- example: [12, 17]\n PF integer, -- personal fouls, example: [39, 132]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n games_played integer, -- example: [1]\n points integer, -- example: [10, 19]\n rebounds integer, -- example: [11, 14]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to firstName, middleName, lastName; age = subtract(2003, year(birthDate)); won the \"Finals MVP\" refers to award = 'Finals MVP'; in 2003 refers to year = 2003\nList the full name and age of the player when he won the \"Finals MVP\" in 2003.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.firstName, T1.middleName, T1.lastName , 2003 - strftime('%Y', T1.birthDate) FROM awards_players AS T2 JOIN players AS T1 ON T2.playerID = T1.playerID WHERE T2.award = 'Finals MVP' AND T2.year = 2003", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT T1.firstName, T1.middleName, T1.lastName , 2003 - strftime('%Y', T1.birthDate) FROM awards_players AS T2 JOIN players AS T1 ON T2.playerID = T1.playerID WHERE T2.award = 'Finals MVP' AND T2.year = 2003", "index": 1423, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['Finals MVP', 'Finals MVP ', 'All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['firstName', 'Alaa', 'Kareem']\n middleName text, -- example: ['middleName', 'Shareef', 'Craig']\n lastName text, -- example: ['lastName', 'Abdelnaby', 'Abdul-Jabbar']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthState text, -- example: ['NY', 'DE']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n assists integer, -- assistants, example: [12, 30]\n blocks integer, -- example: [12, 17]\n PF integer, -- personal fouls, example: [39, 132]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n games_played integer, -- example: [1]\n points integer, -- example: [10, 19]\n rebounds integer, -- example: [11, 14]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to firstName, middleName, lastName; age = subtract(2003, year(birthDate)); won the \"Finals MVP\" refers to award = 'Finals MVP'; in 2003 refers to year = 2003\nList the full name and age of the player when he won the \"Finals MVP\" in 2003.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['F', 'CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n minutes integer, -- example: [18, 30]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n blocks integer, -- example: [12, 17]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostPoints integer, -- post season points, example: [4, 12]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['F', 'C']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n suffixName text, -- example: ['Jr.']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['F', 'Shareef', 'Craig']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F', 'F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nchampion refers to round = 'F'; team name refers to teams.name; from year 1950 to 1960 refers to year between 1950 and 1960\nList the champion (team name) and year from year 1950 to 1960.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT T1.name, T2.year FROM teams AS T1 JOIN series_post AS T2 ON T1.tmID = T2.tmIDWinner WHERE T2.round = 'F' AND T2.year BETWEEN 1950 AND 1960", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT DISTINCT T1.name, T2.year FROM teams AS T1 JOIN series_post AS T2 ON T1.tmID = T2.tmIDWinner WHERE T2.round = 'F' AND T2.year BETWEEN 1950 AND 1960", "index": 1424, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['F', 'CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n minutes integer, -- example: [18, 30]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n blocks integer, -- example: [12, 17]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostPoints integer, -- post season points, example: [4, 12]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['F', 'C']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n suffixName text, -- example: ['Jr.']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['F', 'Shareef', 'Craig']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F', 'F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nchampion refers to round = 'F'; team name refers to teams.name; from year 1950 to 1960 refers to year between 1950 and 1960\nList the champion (team name) and year from year 1950 to 1960.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['firstName', 'Alaa', 'Kareem']\n middleName text, -- example: ['middleName', 'F', 'Shareef', 'Craig']\n lastName text, -- example: ['lastName', 'Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n pos text, -- position, example: ['F', 'F-C', 'C']\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n turnovers integer, -- example: [1, 0]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n pos text, -- position, example: ['F', 'C']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n points integer, -- example: [135, 432]\n assists integer, -- assistants, example: [12, 30]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to firstName, middleName, lastName; won the championship refers to round = 'F'; in 1970 refers to year = 1970\nList out all the players fullname who won the championship in 1970.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT T3.firstName, T3.middleName, T3.lastName FROM series_post AS T1 INNER JOIN players_teams AS T2 ON T1.tmIDWinner = T2.tmID INNER JOIN players AS T3 ON T3.playerID = T2.playerID WHERE T1.year = 1970 AND T1.round = 'F'", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT DISTINCT T3.firstName, T3.middleName, T3.lastName FROM series_post AS T1 INNER JOIN players_teams AS T2 ON T1.tmIDWinner = T2.tmID INNER JOIN players AS T3 ON T3.playerID = T2.playerID WHERE T1.year = 1970 AND T1.round = 'F'", "index": 1425, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['firstName', 'Alaa', 'Kareem']\n middleName text, -- example: ['middleName', 'F', 'Shareef', 'Craig']\n lastName text, -- example: ['lastName', 'Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n pos text, -- position, example: ['F', 'F-C', 'C']\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n turnovers integer, -- example: [1, 0]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n pos text, -- position, example: ['F', 'C']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n points integer, -- example: [135, 432]\n assists integer, -- assistants, example: [12, 30]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to firstName, middleName, lastName; won the championship refers to round = 'F'; in 1970 refers to year = 1970\nList out all the players fullname who won the championship in 1970.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n turnovers integer, -- example: [22, 66]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Max', 'Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Max', 'Alaa', 'Kareem']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Max', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n college text, -- example: ['college', 'Duke', 'UCLA']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['highSchool', 'Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncollege refers to highSchool; won the most award refers to max(count(award)); in 1970 refers to year = 1970\nFrom which college was the player who won the most award in 1970.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT college FROM players WHERE playerID = ( SELECT playerID FROM awards_players WHERE year = 1970 GROUP BY playerID ORDER BY COUNT(award) DESC LIMIT 1 )", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT college FROM players WHERE playerID = ( SELECT playerID FROM awards_players WHERE year = 1970 GROUP BY playerID ORDER BY COUNT(award) DESC LIMIT 1 )", "index": 1426, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n turnovers integer, -- example: [22, 66]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Max', 'Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Max', 'Alaa', 'Kareem']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Max', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n college text, -- example: ['college', 'Duke', 'UCLA']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['highSchool', 'Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncollege refers to highSchool; won the most award refers to max(count(award)); in 1970 refers to year = 1970\nFrom which college was the player who won the most award in 1970.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Max', 'Alaa', 'Kareem']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n pos text, -- position, example: ['F-C', 'C']\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n points integer, -- example: [135, 432]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['Rookie of the Year', 'All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n minutes integer, -- example: [18, 30]\n rebounds integer, -- example: [11, 14]\n steals integer, -- example: [3, 0]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplayer name refers to playerID; the youngest refers to max(birthDate); won \"Rookie of the Year\" refers to award = 'Rookie of the Year'\nName the youngest player who ever won \"Rookie of the Year\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.firstName, T1.middleName, T1.lastName FROM players AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID WHERE T2.award = 'Rookie of the Year' ORDER BY T1.birthDate DESC LIMIT 1", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT T1.firstName, T1.middleName, T1.lastName FROM players AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID WHERE T2.award = 'Rookie of the Year' ORDER BY T1.birthDate DESC LIMIT 1", "index": 1427, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Max', 'Alaa', 'Kareem']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n pos text, -- position, example: ['F-C', 'C']\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n points integer, -- example: [135, 432]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['Rookie of the Year', 'All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n minutes integer, -- example: [18, 30]\n rebounds integer, -- example: [11, 14]\n steals integer, -- example: [3, 0]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplayer name refers to playerID; the youngest refers to max(birthDate); won \"Rookie of the Year\" refers to award = 'Rookie of the Year'\nName the youngest player who ever won \"Rookie of the Year\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Born', 'Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['firstName', 'Alaa', 'Kareem']\n middleName text, -- example: ['middleName', 'Shareef', 'Craig']\n lastName text, -- example: ['lastName', 'Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n pos text, -- position, example: ['F-C', 'C']\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['birthCountry', 'USA', 'EGY']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USa', 'USA', 'FRA']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n minutes integer, -- example: [18, 30]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n assists integer, -- assistants, example: [4, 1]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n fg_made integer, -- field goal made, example: [4, 8]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n confRank integer, -- example: [0, 4]\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n awayWon integer, -- away wins, example: [5, 1]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to firstName, middleName, lastName; in 1973 refers to year = 1973; not born in USA refers to birthCountry <> 'USA'\nList the full name of players who are drafted from round 1 in 1973 but not born in USA.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.firstName, T1.middleName, T1.lastName FROM players AS T1 INNER JOIN draft AS T2 ON T1.playerID = T2.playerID WHERE T2.draftRound = 1 AND T1.birthCountry != 'USA' AND T2.draftYear = 1973", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT T1.firstName, T1.middleName, T1.lastName FROM players AS T1 INNER JOIN draft AS T2 ON T1.playerID = T2.playerID WHERE T2.draftRound = 1 AND T1.birthCountry != 'USA' AND T2.draftYear = 1973", "index": 1428, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Born', 'Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['firstName', 'Alaa', 'Kareem']\n middleName text, -- example: ['middleName', 'Shareef', 'Craig']\n lastName text, -- example: ['lastName', 'Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n pos text, -- position, example: ['F-C', 'C']\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['birthCountry', 'USA', 'EGY']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USa', 'USA', 'FRA']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n minutes integer, -- example: [18, 30]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n assists integer, -- assistants, example: [4, 1]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n fg_made integer, -- field goal made, example: [4, 8]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n confRank integer, -- example: [0, 4]\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n awayWon integer, -- away wins, example: [5, 1]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to firstName, middleName, lastName; in 1973 refers to year = 1973; not born in USA refers to birthCountry <> 'USA'\nList the full name of players who are drafted from round 1 in 1973 but not born in USA.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n firstseason integer, -- example: [0, 1951]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['NJ', 'NY']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin year 2000 refers to year = 2000; percentage = divide(sum(o_rebounds), sum(rebounds)) * 100%\nWhat is the percentage of offense rebounds from the total rebounds of the players in year 2000.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(T2.o_rebounds) AS REAL) * 100 / SUM(T2.rebounds) FROM players_teams AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.year = 2000", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT CAST(SUM(T2.o_rebounds) AS REAL) * 100 / SUM(T2.rebounds) FROM players_teams AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.year = 2000", "index": 1429, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n firstseason integer, -- example: [0, 1951]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['NJ', 'NY']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin year 2000 refers to year = 2000; percentage = divide(sum(o_rebounds), sum(rebounds)) * 100%\nWhat is the percentage of offense rebounds from the total rebounds of the players in year 2000.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Oklahoma City Thunder', 'Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Oklahoma City', 'Oklahoma', 'Oklahoma:', 'Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Oklahoma City', 'Oklahoma', 'Duke', 'UCLA']\n collegeOther text, -- example: ['Oklahoma City', 'Oklahoma', 'Santa Monica City', 'Michigan']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Oklahoma City', 'Bloomfield', 'New York']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n ft_made integer, -- free throw made, example: [2, 3]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncoach refers to coachID; Oklahoma City Thunder refers to name = 'Oklahoma City Thunder'\nList all the coatches of the Oklahoma City Thunder\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 coachID FROM coaches AS T1 INNER JOIN teams AS T2 ON T1.tmID = T2.tmID WHERE name = 'Oklahoma City Thunder'", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT DISTINCT coachID FROM coaches AS T1 INNER JOIN teams AS T2 ON T1.tmID = T2.tmID WHERE name = 'Oklahoma City Thunder'", "index": 1430, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Oklahoma City Thunder', 'Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Oklahoma City', 'Oklahoma', 'Oklahoma:', 'Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Oklahoma City', 'Oklahoma', 'Duke', 'UCLA']\n collegeOther text, -- example: ['Oklahoma City', 'Oklahoma', 'Santa Monica City', 'Michigan']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Oklahoma City', 'Bloomfield', 'New York']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n ft_made integer, -- free throw made, example: [2, 3]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncoach refers to coachID; Oklahoma City Thunder refers to name = 'Oklahoma City Thunder'\nList all the coatches of the Oklahoma City Thunder\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndid not get more than 10 steals refers to count(steals) < = 10; between the years 2000 and 2005 refers to season_id between 2000 and 2005\nHow many players did not get more than 10 steals between the years 2000 and 2005?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(DISTINCT playerID) FROM player_allstar WHERE season_id BETWEEN 2000 AND 2005 AND steals <= 10", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT COUNT(DISTINCT playerID) FROM player_allstar WHERE season_id BETWEEN 2000 AND 2005 AND steals <= 10", "index": 1431, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndid not get more than 10 steals refers to count(steals) < = 10; between the years 2000 and 2005 refers to season_id between 2000 and 2005\nHow many players did not get more than 10 steals between the years 2000 and 2005?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n assists integer, -- assistants, example: [12, 30]\n PostPoints integer, -- post season points, example: [4, 12]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n post_wins integer, -- post season wins, example: [0, 12]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n lost integer, -- example: [4, 5]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n college text, -- example: ['Duke', 'UCLA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1973 season refers to season_id = 1973; black refers to race = 'B'\nHow many All Star players who played in the 1973 season were black?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.playerID) FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T2.season_id = 1973 AND T1.race = 'B'", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T1.playerID) FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T2.season_id = 1973 AND T1.race = 'B'", "index": 1432, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n assists integer, -- assistants, example: [12, 30]\n PostPoints integer, -- post season points, example: [4, 12]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n post_wins integer, -- post season wins, example: [0, 12]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n lost integer, -- example: [4, 5]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n college text, -- example: ['Duke', 'UCLA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1973 season refers to season_id = 1973; black refers to race = 'B'\nHow many All Star players who played in the 1973 season were black?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Houston', 'Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_made integer, -- free throw made, example: [2, 3]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n collegeOther text, -- example: ['Houston', 'Santa Monica City', 'Michigan']\n birthCountry text, -- example: ['EGY', 'USA']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n confRank integer, -- example: [0, 4]\n name text, -- example: ['Houston Mavericks', 'Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n suffixName text, -- example: ['Jr.']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHouston Mavericks refers to name = 'Houston Mavericks'; percentage = divide(sum(lost), sum(games)) * 100%\nPercentage of games lost out of total games played by the Houston Mavericks\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(lost) AS REAL) * 100 / SUM(games) FROM teams WHERE name = 'Houston Mavericks'", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT CAST(SUM(lost) AS REAL) * 100 / SUM(games) FROM teams WHERE name = 'Houston Mavericks'", "index": 1433, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Houston', 'Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_made integer, -- free throw made, example: [2, 3]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n collegeOther text, -- example: ['Houston', 'Santa Monica City', 'Michigan']\n birthCountry text, -- example: ['EGY', 'USA']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n confRank integer, -- example: [0, 4]\n name text, -- example: ['Houston Mavericks', 'Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n suffixName text, -- example: ['Jr.']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHouston Mavericks refers to name = 'Houston Mavericks'; percentage = divide(sum(lost), sum(games)) * 100%\nPercentage of games lost out of total games played by the Houston Mavericks\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['ID', 'NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['ID', 'NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['Most Valuable Player', 'All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplayer refers to playerID; \"Most Valuable Player\" award refers to award = 'Most Valuable Player'; after the year of 1990 refers to year > 1990; ID refers to playerID\nPlease list the players who received the \"Most Valuable Player\" award in the NBA league after the year of 1990, along with their IDs.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT playerID FROM awards_players WHERE year > 1990 AND award = 'Most Valuable Player' AND lgID = 'NBA'", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT playerID FROM awards_players WHERE year > 1990 AND award = 'Most Valuable Player' AND lgID = 'NBA'", "index": 1434, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['ID', 'NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['ID', 'NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['Most Valuable Player', 'All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplayer refers to playerID; \"Most Valuable Player\" award refers to award = 'Most Valuable Player'; after the year of 1990 refers to year > 1990; ID refers to playerID\nPlease list the players who received the \"Most Valuable Player\" award in the NBA league after the year of 1990, along with their IDs.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n steals integer, -- example: [4, 25]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n o_fgm integer, -- offense field goal made, example: [249, 243]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n post_wins integer, -- post season wins, example: [0, 12]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n league_id text, -- example: ['NBA', 'ABA']\n minutes integer, -- example: [18, 30]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 1969 refers to year = 1969; awarded \"NBA Coach of the Year\" refers to award = 'NBA Coach of the Year'; percentage = divide(count(coachID where year = 1969 and award = 'NBA Coach of the Year'), count(coachID)) * 100%\nWhat is the percentage of coaches in 1969 who were awarded \"NBA Coach of the Year\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 award = 'NBA Coach of the Year' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM awards_coaches WHERE year = 1969", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN award = 'NBA Coach of the Year' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM awards_coaches WHERE year = 1969", "index": 1435, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n steals integer, -- example: [4, 25]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n o_fgm integer, -- offense field goal made, example: [249, 243]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n post_wins integer, -- post season wins, example: [0, 12]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n league_id text, -- example: ['NBA', 'ABA']\n minutes integer, -- example: [18, 30]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 1969 refers to year = 1969; awarded \"NBA Coach of the Year\" refers to award = 'NBA Coach of the Year'; percentage = divide(count(coachID where year = 1969 and award = 'NBA Coach of the Year'), count(coachID)) * 100%\nWhat is the percentage of coaches in 1969 who were awarded \"NBA Coach of the Year\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['CHS', 'POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['CHS', 'POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['CHS', 'PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['CHS', 'AFS', 'AGW']\n franchID text, -- example: ['CHS', 'AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['CHS', 'ANA', 'DNR']\n firstName text, -- example: ['Win', 'Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Win', 'Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['S.', 'Shareef', 'Craig']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCHS team refers to tmIDWinner = 'CHS'; difference = subtract(divide(count(series_post where year = 1947 and tmIDWinner = 'CHS'), count(series_post where year = 1947)), divide(count(series_post where year = 1946 and tmIDWinner = 'CHS'), count(series_post where year = 1946)))\nWhat were the difference of the CHS team's winning rate between 1946 and 1947 in the post-season series games? Please provide your answer in percentages.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 year = 1947 AND tmIDWinner = 'CHS' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN year = 1947 THEN 1 ELSE 0 END) - CAST(SUM(CASE WHEN year = 1946 AND tmIDWinner = 'CHS' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN year = 1946 THEN 1 ELSE 0 END) FROM series_post", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN year = 1947 AND tmIDWinner = 'CHS' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN year = 1947 THEN 1 ELSE 0 END) - CAST(SUM(CASE WHEN year = 1946 AND tmIDWinner = 'CHS' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN year = 1946 THEN 1 ELSE 0 END) FROM series_post", "index": 1436, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['CHS', 'POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['CHS', 'POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['CHS', 'PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['CHS', 'AFS', 'AGW']\n franchID text, -- example: ['CHS', 'AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['CHS', 'ANA', 'DNR']\n firstName text, -- example: ['Win', 'Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Win', 'Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['S.', 'Shareef', 'Craig']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCHS team refers to tmIDWinner = 'CHS'; difference = subtract(divide(count(series_post where year = 1947 and tmIDWinner = 'CHS'), count(series_post where year = 1947)), divide(count(series_post where year = 1946 and tmIDWinner = 'CHS'), count(series_post where year = 1946)))\nWhat were the difference of the CHS team's winning rate between 1946 and 1947 in the post-season series games? Please provide your answer in percentages.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n minutes integer, -- example: [18, 30]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n confRank integer, -- example: [0, 4]\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n homeWon integer, -- home wins, example: [8, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n middleName text, -- example: ['Shareef', 'Craig']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['highSchool', 'University', 'University ', 'Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['Finals MVP ', 'Finals MVP', 'All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\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 university refers to highSchool; NBA refers to lgID = 'NBA'; Finals MVP refers to award = 'Finals MVP'; in 1990 refers to year = 1990\nWhat is the name of the university that was drafted from the player who won the NBA Finals MVP in 1990?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.college FROM players AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 1990 AND T2.award = 'Finals MVP'", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT T1.college FROM players AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 1990 AND T2.award = 'Finals MVP'", "index": 1437, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n minutes integer, -- example: [18, 30]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n confRank integer, -- example: [0, 4]\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n homeWon integer, -- home wins, example: [8, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n middleName text, -- example: ['Shareef', 'Craig']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['highSchool', 'University', 'University ', 'Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['Finals MVP ', 'Finals MVP', 'All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\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 university refers to highSchool; NBA refers to lgID = 'NBA'; Finals MVP refers to award = 'Finals MVP'; in 1990 refers to year = 1990\nWhat is the name of the university that was drafted from the player who won the NBA Finals MVP in 1990?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n turnovers integer, -- example: [22, 66]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n blocks integer, -- example: [2, 0]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n awayLost integer, -- away loses, example: [3, 4]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n post_wins integer, -- post season wins, example: [0, 12]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n pos text, -- position, example: ['F-C', 'C']\n lastseason integer, -- example: [0, 1951]\n birthCountry text, -- example: ['EGY', 'USA']\n hsState text, -- high school state, example: ['NJ', 'NY']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom 1980 to 1983 refers to year BETWEEN 1980 and 1983; NBA refers to lgID = 'NBA'; more than 60% three point rate refers to divide(threeMade, threeAttempted) > 0.6\nFrom 1980 to 1983, how many of the NBA All-Star players have more than 60% three point rate?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.playerID FROM player_allstar AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE T2.year BETWEEN 1980 AND 1983 AND T1.three_made / T1.three_attempted > 0.6", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT DISTINCT T2.playerID FROM player_allstar AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE T2.year BETWEEN 1980 AND 1983 AND T1.three_made / T1.three_attempted > 0.6", "index": 1438, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n turnovers integer, -- example: [22, 66]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n blocks integer, -- example: [2, 0]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n awayLost integer, -- away loses, example: [3, 4]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n post_wins integer, -- post season wins, example: [0, 12]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n pos text, -- position, example: ['F-C', 'C']\n lastseason integer, -- example: [0, 1951]\n birthCountry text, -- example: ['EGY', 'USA']\n hsState text, -- high school state, example: ['NJ', 'NY']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom 1980 to 1983 refers to year BETWEEN 1980 and 1983; NBA refers to lgID = 'NBA'; more than 60% three point rate refers to divide(threeMade, threeAttempted) > 0.6\nFrom 1980 to 1983, how many of the NBA All-Star players have more than 60% three point rate?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['CHI', 'AFS', 'AGW']\n franchID text, -- example: ['CHI', 'AFS', 'AGW']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['CHI', 'PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHI', 'CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['CHI', 'POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['CHI', 'ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['CHI', 'POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n rebounds integer, -- example: [89, 260]\n blocks integer, -- example: [12, 17]\n PF integer, -- personal fouls, example: [39, 132]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n nameSuffix text, -- example: ['Jr.', 'III']\n pos text, -- position, example: ['F-C', 'C']\n lastseason integer, -- example: [0, 1951]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCHI refers to tmID = 'CHI'; awarded Coach of the Year refers to award = 'Coach of the Year'; NBA refers to lgID = 'NBA'\nHow many times have coaches who were from CHI been awarded as NBA Coach of the Year?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(DISTINCT T2.coachID) FROM coaches AS T1 INNER JOIN awards_coaches AS T2 ON T1.coachID = T2.coachID WHERE T1.tmID = 'CHI' AND T2.award = 'NBA Coach of the Year'", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T2.coachID) FROM coaches AS T1 INNER JOIN awards_coaches AS T2 ON T1.coachID = T2.coachID WHERE T1.tmID = 'CHI' AND T2.award = 'NBA Coach of the Year'", "index": 1439, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['CHI', 'AFS', 'AGW']\n franchID text, -- example: ['CHI', 'AFS', 'AGW']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['CHI', 'PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHI', 'CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['CHI', 'POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['CHI', 'ANA', 'DNR']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['CHI', 'POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n rebounds integer, -- example: [89, 260]\n blocks integer, -- example: [12, 17]\n PF integer, -- personal fouls, example: [39, 132]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n nameSuffix text, -- example: ['Jr.', 'III']\n pos text, -- position, example: ['F-C', 'C']\n lastseason integer, -- example: [0, 1951]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCHI refers to tmID = 'CHI'; awarded Coach of the Year refers to award = 'Coach of the Year'; NBA refers to lgID = 'NBA'\nHow many times have coaches who were from CHI been awarded as NBA Coach of the Year?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Max', 'Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Forest', 'Max', 'Darrell', 'Bob']\n lastName text, -- example: ['Forest', 'Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Wake Forest', 'Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Forest', 'Max', 'Alaa', 'Kareem']\n firstName text, -- example: ['Forest', 'Max', 'Alaa', 'Kareem']\n middleName text, -- example: ['Forest', 'Max', 'Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Max', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Wake Forest', 'college', 'Duke', 'UCLA']\n collegeOther text, -- example: ['Wake Forest', 'Wake Forest ?', 'Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['highSchool', 'Forest', 'Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Forest', 'Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWake Forest college refers to highSchool = 'Wake Forest college'; did the most offensive rebounds than defensive rebounds refers to max(subtract(sum(oRebounds), sum(dRebounds))); full name refers to first_name, middle_name, last_name\nWhich player from Wake Forest college did the most offensive rebounds than defensive rebounds in the all-star? Please mention the full name of the player including the middle name if have any.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.firstName, T1.middleName, T1.lastName FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.college = 'Wake Forest' AND T2.o_rebounds > T2.d_rebounds", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT T1.firstName, T1.middleName, T1.lastName FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.college = 'Wake Forest' AND T2.o_rebounds > T2.d_rebounds", "index": 1440, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Max', 'Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Forest', 'Max', 'Darrell', 'Bob']\n lastName text, -- example: ['Forest', 'Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Wake Forest', 'Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Forest', 'Max', 'Alaa', 'Kareem']\n firstName text, -- example: ['Forest', 'Max', 'Alaa', 'Kareem']\n middleName text, -- example: ['Forest', 'Max', 'Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Max', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Wake Forest', 'college', 'Duke', 'UCLA']\n collegeOther text, -- example: ['Wake Forest', 'Wake Forest ?', 'Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['highSchool', 'Forest', 'Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Forest', 'Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWake Forest college refers to highSchool = 'Wake Forest college'; did the most offensive rebounds than defensive rebounds refers to max(subtract(sum(oRebounds), sum(dRebounds))); full name refers to first_name, middle_name, last_name\nWhich player from Wake Forest college did the most offensive rebounds than defensive rebounds in the all-star? Please mention the full name of the player including the middle name if have any.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n games_played integer, -- example: [1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n suffixName text, -- example: ['Jr.']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n rank integer, -- example: [1, 2]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n lost integer, -- example: [4, 5]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n nameSuffix text, -- example: ['Jr.', 'III']\n pos text, -- position, example: ['F-C', 'C']\n lastseason integer, -- example: [0, 1951]\n birthCountry text, -- example: ['EGY', 'USA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\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 team refers to teams.name; between 1980 and 2000 refers to year between 1980 and 2000; ranked first five or more times refers to count(rank = 1) > = 5; lost a league two or more times refers to lost > 2\nState the name of teams ranked first five or more times and lost a league two or more times between 1980 and 2000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.name FROM teams AS T1 INNER JOIN series_post AS T2 ON T1.tmID = T2.tmIDLoser AND T1.year = T2.year WHERE T1.rank < 5 AND T2.lgIDLoser > 2 AND T2.year BETWEEN 1980 AND 2000", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT T1.name FROM teams AS T1 INNER JOIN series_post AS T2 ON T1.tmID = T2.tmIDLoser AND T1.year = T2.year WHERE T1.rank < 5 AND T2.lgIDLoser > 2 AND T2.year BETWEEN 1980 AND 2000", "index": 1441, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n games_played integer, -- example: [1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n suffixName text, -- example: ['Jr.']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n rank integer, -- example: [1, 2]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n lost integer, -- example: [4, 5]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n nameSuffix text, -- example: ['Jr.', 'III']\n pos text, -- position, example: ['F-C', 'C']\n lastseason integer, -- example: [0, 1951]\n birthCountry text, -- example: ['EGY', 'USA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\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 team refers to teams.name; between 1980 and 2000 refers to year between 1980 and 2000; ranked first five or more times refers to count(rank = 1) > = 5; lost a league two or more times refers to lost > 2\nState the name of teams ranked first five or more times and lost a league two or more times between 1980 and 2000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n d_pts integer, -- defense points, example: [578, 498]\n homeLost integer, -- home loses, example: [1, 2]\n lost integer, -- example: [4, 5]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n assists integer, -- assistants, example: [4, 1]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n oRebounds integer, -- offense rebounds, example: [27, 81]\n fgMade integer, -- field goal made, example: [55, 178]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfirst round refers to round = 1; in 1996 refers to year = 1996; NBA refers to lgID = 'NBA'\nHow many first round draft player in 1996 NBA draft became an All-Star?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.playerID) FROM draft AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.draftYear = 1996 AND T1.draftRound = 1", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT COUNT(T2.playerID) FROM draft AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.draftYear = 1996 AND T1.draftRound = 1", "index": 1442, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n d_pts integer, -- defense points, example: [578, 498]\n homeLost integer, -- home loses, example: [1, 2]\n lost integer, -- example: [4, 5]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n assists integer, -- assistants, example: [4, 1]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n oRebounds integer, -- offense rebounds, example: [27, 81]\n fgMade integer, -- field goal made, example: [55, 178]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfirst round refers to round = 1; in 1996 refers to year = 1996; NBA refers to lgID = 'NBA'\nHow many first round draft player in 1996 NBA draft became an All-Star?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n won integer, -- example: [14, 13]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n lastseason integer, -- example: [0, 1951]\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_made integer, -- free throw made, example: [2, 3]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteam refers to tmID; MVP refers to award like '%MVP'; 1997 refers to year = 1997; NBA refers to lgID = 'NBA'\nWhich team did the MVP of 1997 NBA season play 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 DISTINCT T3.tmID FROM players_teams AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID INNER JOIN teams AS T3 ON T1.tmID = T3.tmID AND T1.year = T3.year WHERE T2.year = 1997 AND T2.award = 'Finals MVP' LIMIT 1", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT DISTINCT T3.tmID FROM players_teams AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID INNER JOIN teams AS T3 ON T1.tmID = T3.tmID AND T1.year = T3.year WHERE T2.year = 1997 AND T2.award = 'Finals MVP' LIMIT 1", "index": 1443, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n won integer, -- example: [14, 13]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n lastseason integer, -- example: [0, 1951]\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_made integer, -- free throw made, example: [2, 3]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteam refers to tmID; MVP refers to award like '%MVP'; 1997 refers to year = 1997; NBA refers to lgID = 'NBA'\nWhich team did the MVP of 1997 NBA season play 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 teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Champion', 'Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nturnovers per game = avg(turnovers); 2003 refers to year = 2003; NBA refers to lgID = 'NBA'\nHow many turnovers per game did the assist champion had in the 2003 NBA season?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT AVG(T2.turnovers) FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 2003 GROUP BY T1.playerID, T2.assists ORDER BY T2.assists DESC LIMIT 1", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT AVG(T2.turnovers) FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 2003 GROUP BY T1.playerID, T2.assists ORDER BY T2.assists DESC LIMIT 1", "index": 1444, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n firstName text, -- example: ['Alaa', 'Kareem']\n middleName text, -- example: ['Shareef', 'Craig']\n lastName text, -- example: ['Champion', 'Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nturnovers per game = avg(turnovers); 2003 refers to year = 2003; NBA refers to lgID = 'NBA'\nHow many turnovers per game did the assist champion had in the 2003 NBA season?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Allen', 'Ray', 'Darrell', 'Bob']\n lastName text, -- example: ['Allen', 'Ray', 'Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n homeWon integer, -- home wins, example: [8, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Allen', 'Ray', 'Alaa', 'Kareem']\n lastName text, -- example: ['Allen', 'Ray', 'Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameNick text, -- nick name, example: ['Ray', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n assists integer, -- assistants, example: [12, 30]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n ftMade integer, -- free throw made, example: [25, 76]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNBA refers to lgID = 'NBA'\nWhat is the number of NBA titles that Ray Allen has won throughout his NBA career?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.playerID) FROM player_allstar AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID WHERE first_name = 'Ray' AND last_name = 'Allen'", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT COUNT(T1.playerID) FROM player_allstar AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID WHERE first_name = 'Ray' AND last_name = 'Allen'", "index": 1445, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Allen', 'Ray', 'Darrell', 'Bob']\n lastName text, -- example: ['Allen', 'Ray', 'Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n homeWon integer, -- home wins, example: [8, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Allen', 'Ray', 'Alaa', 'Kareem']\n lastName text, -- example: ['Allen', 'Ray', 'Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameNick text, -- nick name, example: ['Ray', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n assists integer, -- assistants, example: [12, 30]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n ftMade integer, -- free throw made, example: [25, 76]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNBA refers to lgID = 'NBA'\nWhat is the number of NBA titles that Ray Allen has won throughout his NBA career?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['POR', 'PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['POR', 'CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['POR', 'ANA', 'DNR']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n games_played integer, -- example: [1]\n points integer, -- example: [10, 19]\n rebounds integer, -- example: [11, 14]\n fg_made integer, -- field goal made, example: [4, 8]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['POR', 'AFS', 'AGW']\n rank integer, -- example: [1, 2]\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n homeWon integer, -- home wins, example: [8, 2]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n nameSuffix text, -- example: ['Jr.', 'III']\n firstseason integer, -- example: [0, 1951]\n birthCity text, -- example: ['Cairo', 'New York']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n steals integer, -- example: [4, 25]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe 'NBA coach of the year' award refers to award = 'NBA coach of the year'; from 1971 - 1975 refers to year between 1971 and 1975; 'POR' team refers to tmID = 'POR'\nAmong the coaches who won the 'NBA coach of the year' award from 1971 - 1975, how many of them were in 'POR' team?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T1.id) FROM awards_coaches AS T1 INNER JOIN teams AS T2 ON T1.year = T2.year WHERE T1.year BETWEEN 1971 AND 1975 AND T1.award = 'NBA Coach of the Year' AND T2.tmID = 'POR'", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT COUNT(T1.id) FROM awards_coaches AS T1 INNER JOIN teams AS T2 ON T1.year = T2.year WHERE T1.year BETWEEN 1971 AND 1975 AND T1.award = 'NBA Coach of the Year' AND T2.tmID = 'POR'", "index": 1446, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['POR', 'PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['POR', 'CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['POR', 'ANA', 'DNR']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n games_played integer, -- example: [1]\n points integer, -- example: [10, 19]\n rebounds integer, -- example: [11, 14]\n fg_made integer, -- field goal made, example: [4, 8]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['POR', 'AFS', 'AGW']\n rank integer, -- example: [1, 2]\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n homeWon integer, -- home wins, example: [8, 2]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n nameSuffix text, -- example: ['Jr.', 'III']\n firstseason integer, -- example: [0, 1951]\n birthCity text, -- example: ['Cairo', 'New York']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n steals integer, -- example: [4, 25]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe 'NBA coach of the year' award refers to award = 'NBA coach of the year'; from 1971 - 1975 refers to year between 1971 and 1975; 'POR' team refers to tmID = 'POR'\nAmong the coaches who won the 'NBA coach of the year' award from 1971 - 1975, how many of them were in 'POR' team?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Max', 'Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n rebounds integer, -- example: [11, 14]\n steals integer, -- example: [3, 0]\n turnovers integer, -- example: [1, 0]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Max', 'Alaa', 'Kareem']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n pos text, -- position, example: ['F-C', 'C']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeLost integer, -- home loses, example: [1, 2]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n rebounds integer, -- example: [89, 260]\n steals integer, -- example: [4, 25]\n turnovers integer, -- example: [22, 66]\n fgMade integer, -- field goal made, example: [55, 178]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\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 player refers to first_name, middle_name, last_name; in 1996 refers to year = 1996; the most steals refers to max(steals); didn't play in the playoffs refers to playoff = null\nWhat's the name of the player in 1996 who had the most steals that didn't play in the playoffs?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.playerID FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 1996 AND T2.PostGP = 0 ORDER BY T2.steals DESC LIMIT 1", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT T1.playerID FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 1996 AND T2.PostGP = 0 ORDER BY T2.steals DESC LIMIT 1", "index": 1447, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n first_name text, -- example: ['Max', 'Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n rebounds integer, -- example: [11, 14]\n steals integer, -- example: [3, 0]\n turnovers integer, -- example: [1, 0]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Max', 'Alaa', 'Kareem']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n pos text, -- position, example: ['F-C', 'C']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeLost integer, -- home loses, example: [1, 2]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n rebounds integer, -- example: [89, 260]\n steals integer, -- example: [4, 25]\n turnovers integer, -- example: [22, 66]\n fgMade integer, -- field goal made, example: [55, 178]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\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 player refers to first_name, middle_name, last_name; in 1996 refers to year = 1996; the most steals refers to max(steals); didn't play in the playoffs refers to playoff = null\nWhat's the name of the player in 1996 who had the most steals that didn't play in the playoffs?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n steals integer, -- example: [3, 0]\n turnovers integer, -- example: [1, 0]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Max', 'Alaa', 'Kareem']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Max', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n height real, -- example: [82.0, 85.0]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthState text, -- example: ['MAN', 'ID', 'NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['ID', 'NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most turnovers refers to max(turnovers); missed the playoffs refers to PostGP = 0; in year 1988 refers to year = 1988\nGive the player id of the man who had the most turnovers whose team missed the playoffs in year 1988.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.playerID FROM players_teams AS T1 INNER JOIN players AS T2 ON T1.playerID = T2.playerID WHERE T1.PostGP = 0 AND T1.year = 1988 ORDER BY T1.turnovers DESC LIMIT 1", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT T2.playerID FROM players_teams AS T1 INNER JOIN players AS T2 ON T1.playerID = T2.playerID WHERE T1.PostGP = 0 AND T1.year = 1988 ORDER BY T1.turnovers DESC LIMIT 1", "index": 1448, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n steals integer, -- example: [3, 0]\n turnovers integer, -- example: [1, 0]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_attempted integer, -- three point attempted, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Max', 'Alaa', 'Kareem']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Max', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n height real, -- example: [82.0, 85.0]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthState text, -- example: ['MAN', 'ID', 'NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsState text, -- high school state, example: ['ID', 'NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most turnovers refers to max(turnovers); missed the playoffs refers to PostGP = 0; in year 1988 refers to year = 1988\nGive the player id of the man who had the most turnovers whose team missed the playoffs in year 1988.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n pos text, -- position, example: ['F-C', 'C']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name of the team refers to teams.name; in 2001 refers to year = 2001; didn't make the playoffs refers to PostGP = 0; won the most games refers to max(won)\nWhat's the full name of the team that won the most games in 2001 but didn't make the playoffs?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.tmID FROM players_teams AS T1 INNER JOIN teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.PostGP = 0 ORDER BY T2.won DESC LIMIT 1", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT T2.tmID FROM players_teams AS T1 INNER JOIN teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.PostGP = 0 ORDER BY T2.won DESC LIMIT 1", "index": 1449, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n pos text, -- position, example: ['F-C', 'C']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name of the team refers to teams.name; in 2001 refers to year = 2001; didn't make the playoffs refers to PostGP = 0; won the most games refers to max(won)\nWhat's the full name of the team that won the most games in 2001 but didn't make the playoffs?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n minutes integer, -- example: [18, 30]\n rebounds integer, -- example: [11, 14]\n turnovers integer, -- example: [1, 0]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n weight integer, -- example: [240, 225]\n birthState text, -- example: ['NY', 'DE']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n points integer, -- example: [135, 432]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostPoints integer, -- post season points, example: [4, 12]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n awayWon integer, -- away wins, example: [5, 1]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndidn't play in playoffs refers to PostGP = 0; in the year 1997 refers to year = 1997; the most total rebounds refers to max(o_tmRebound)\nWhich team that didn't play in playoffs had the most total rebounds in the year 1997?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.tmID FROM players_teams AS T1 INNER JOIN teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.PostGP = 0 AND T1.year = 1997 ORDER BY T1.rebounds DESC LIMIT 1", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT T2.tmID FROM players_teams AS T1 INNER JOIN teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.PostGP = 0 AND T1.year = 1997 ORDER BY T1.rebounds DESC LIMIT 1", "index": 1450, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n minutes integer, -- example: [18, 30]\n rebounds integer, -- example: [11, 14]\n turnovers integer, -- example: [1, 0]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n weight integer, -- example: [240, 225]\n birthState text, -- example: ['NY', 'DE']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n points integer, -- example: [135, 432]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n blocks integer, -- example: [12, 17]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostPoints integer, -- post season points, example: [4, 12]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n awayWon integer, -- away wins, example: [5, 1]\n won integer, -- example: [14, 13]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndidn't play in playoffs refers to PostGP = 0; in the year 1997 refers to year = 1997; the most total rebounds refers to max(o_tmRebound)\nWhich team that didn't play in playoffs had the most total rebounds in the year 1997?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n blocks integer, -- example: [12, 17]\n ftMade integer, -- free throw made, example: [25, 76]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n points integer, -- example: [10, 19]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n ft_made integer, -- free throw made, example: [2, 3]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n rank integer, -- example: [1, 2]\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n pos text, -- position, example: ['F-C', 'C']\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndrafted in the 1st round refers to draftRound = 1; 6th position refers to draftSelection = 6; in 1976 refers to year = 1976; team refers to tmID\nFor the player who was drafted in the 1st round, 6th position in 1976, which team did he play in that year?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.tmID FROM draft AS T1 INNER JOIN teams AS T2 ON T1.tmID = T2.tmID AND T1.draftYear = T2.year WHERE T1.draftRound = 1 AND T1.draftSelection = 6 AND T1.draftYear = 1976", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT T2.tmID FROM draft AS T1 INNER JOIN teams AS T2 ON T1.tmID = T2.tmID AND T1.draftYear = T2.year WHERE T1.draftRound = 1 AND T1.draftSelection = 6 AND T1.draftYear = 1976", "index": 1451, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n points integer, -- example: [135, 432]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n blocks integer, -- example: [12, 17]\n ftMade integer, -- free throw made, example: [25, 76]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n league_id text, -- example: ['NBA', 'ABA']\n games_played integer, -- example: [1]\n points integer, -- example: [10, 19]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n ft_made integer, -- free throw made, example: [2, 3]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n rank integer, -- example: [1, 2]\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n awayWon integer, -- away wins, example: [5, 1]\n awayLost integer, -- away loses, example: [3, 4]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Alaa', 'Kareem']\n pos text, -- position, example: ['F-C', 'C']\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndrafted in the 1st round refers to draftRound = 1; 6th position refers to draftSelection = 6; in 1976 refers to year = 1976; team refers to tmID\nFor the player who was drafted in the 1st round, 6th position in 1976, which team did he play in that year?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GS integer, -- game starting, example: [0, 69]\n points integer, -- example: [135, 432]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Win', 'Darrell', 'Bob']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n awayWon integer, -- away wins, example: [5, 1]\n won integer, -- example: [14, 13]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Pick', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthState text, -- example: ['NY', 'DE']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 1998 refers to year = 1998; 1st round refers to draftRound = 1; 12th pick refers to draftSelection = 12; home win refers to homeWon\nIn the year 1998, how many home wins did the team which had the 1st round, 12th pick have that year?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.homeWon FROM draft AS T1 INNER JOIN teams AS T2 ON T1.tmID = T2.tmID AND T1.draftYear = T2.year WHERE T1.draftRound = 1 AND T1.draftSelection = 12 AND T1.draftYear = 1998", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT T2.homeWon FROM draft AS T1 INNER JOIN teams AS T2 ON T1.tmID = T2.tmID AND T1.draftYear = T2.year WHERE T1.draftRound = 1 AND T1.draftSelection = 12 AND T1.draftYear = 1998", "index": 1452, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GS integer, -- game starting, example: [0, 69]\n points integer, -- example: [135, 432]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Win', 'Darrell', 'Bob']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['CF', 'WC']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n awayWon integer, -- away wins, example: [5, 1]\n won integer, -- example: [14, 13]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Pick', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthState text, -- example: ['NY', 'DE']\n hsCity text, -- high school city, example: ['Bloomfield', 'New York']\n PRIMARY KEY (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 1998 refers to year = 1998; 1st round refers to draftRound = 1; 12th pick refers to draftSelection = 12; home win refers to homeWon\nIn the year 1998, how many home wins did the team which had the 1st round, 12th pick have that year?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['F', 'CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Max', 'Alaa', 'Kareem']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Max', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['pos', 'F-G', 'F', 'F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_made integer, -- free throw made, example: [2, 3]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteam refers to tmID; the youngest refers to max(year); F-G position refers to pos like '%F'; NBA refers to lgID = 'NBA'\nWhich team did the youngest player who could be in F-G position play in the NBA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.tmID FROM teams AS T1 INNER JOIN players_teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year INNER JOIN players AS T3 ON T2.playerID = T3.playerID WHERE T3.pos = 'F-G' AND T2.lgID = 'NBA' ORDER BY T3.birthDate DESC LIMIT 1", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT T1.tmID FROM teams AS T1 INNER JOIN players_teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year INNER JOIN players AS T3 ON T2.playerID = T3.playerID WHERE T3.pos = 'F-G' AND T2.lgID = 'NBA' ORDER BY T3.birthDate DESC LIMIT 1", "index": 1453, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n steals integer, -- example: [4, 25]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftAttempted integer, -- free throw attempted, example: [44, 101]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostRebounds integer, -- post season defense rebounds, example: [3, 4]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBA', 'NBL']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n divID text, -- division ID, example: ['EA', 'WE']\n rank integer, -- example: [1, 2]\n confRank integer, -- example: [0, 4]\n playoff text, -- example: ['F', 'CF', 'WC']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n series text, -- example: ['O', 'M']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n useFirst text, -- use first name, example: ['Max', 'Alaa', 'Kareem']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n middleName text, -- example: ['Max', 'Shareef', 'Craig']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n fullGivenName text, -- example: ['Ferdinand Lewis Alcindor, Jr.', 'Walter Raphael Hazzard, Jr.']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Max', 'Lew, Cap', 'Walt']\n pos text, -- position, example: ['pos', 'F-G', 'F', 'F-C', 'C']\n firstseason integer, -- example: [0, 1951]\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCity text, -- example: ['Cairo', 'New York']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_made integer, -- free throw made, example: [2, 3]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n suffixName text, -- example: ['Jr.']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteam refers to tmID; the youngest refers to max(year); F-G position refers to pos like '%F'; NBA refers to lgID = 'NBA'\nWhich team did the youngest player who could be in F-G position play in the NBA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n points integer, -- example: [135, 432]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n turnovers integer, -- example: [22, 66]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n minutes integer, -- example: [18, 30]\n turnovers integer, -- example: [1, 0]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull attendance refers to GP = 82; in 1995 refers to year = 1995; the most turnovers refers to max(turnovers); full name refers to first_name, last_name\nFor all the full attendence players in 1995, which player had most turnovers? Give the full name of the player.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.firstName, T1.middleName, T1.lastName FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE T2.GP = 82 AND T2.year = 1995 ORDER BY T2.turnovers DESC LIMIT 1", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT T1.firstName, T1.middleName, T1.lastName FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE T2.GP = 82 AND T2.year = 1995 ORDER BY T2.turnovers DESC LIMIT 1", "index": 1454, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Max', 'Alaa', 'Kareem']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n GP integer, -- game presentatons, example: [43, 71]\n points integer, -- example: [135, 432]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n turnovers integer, -- example: [22, 66]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostTurnovers integer, -- post season turnovers, example: [0, 2]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n minutes integer, -- example: [18, 30]\n turnovers integer, -- example: [1, 0]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Max', 'Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n lgID text, -- league ID, example: ['NBA', 'ABA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_ftm integer, -- offense free throw made, example: [183, 159]\n games integer, -- example: [18, 9]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull attendance refers to GP = 82; in 1995 refers to year = 1995; the most turnovers refers to max(turnovers); full name refers to first_name, last_name\nFor all the full attendence players in 1995, which player had most turnovers? Give the full name of the player.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n firstseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['NJ', 'NY']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n d_pts integer, -- defense points, example: [578, 498]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe same starting player refers to GP = GS; full name of the team refers to teams.name\nWhich team had the most same starting players througout the season? Give the full name of the team.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.tmID FROM teams AS T1 INNER JOIN players_teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T2.GP = T2.GS", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT DISTINCT T1.tmID FROM teams AS T1 INNER JOIN players_teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T2.GP = T2.GS", "index": 1455, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n firstName text, -- example: ['Alaa', 'Kareem']\n lastName text, -- example: ['Abdelnaby', 'Abdul-Jabbar']\n firstseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthDate date, -- example: ['1968-06-24', '1947-04-16']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['NJ', 'NY']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n GS integer, -- game starting, example: [0, 69]\n minutes integer, -- example: [290, 934]\n oRebounds integer, -- offense rebounds, example: [27, 81]\n rebounds integer, -- example: [89, 260]\n assists integer, -- assistants, example: [12, 30]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n PF integer, -- personal fouls, example: [39, 132]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftMade integer, -- free throw made, example: [25, 76]\n threeAttempted integer, -- three point attempted, example: [0, 1]\n threeMade integer, -- three point made, example: [0, 1]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostoRebounds integer, -- post season offense rebounds, example: [1, 0]\n PostdRebounds integer, -- post season defense rebounds, example: [2, 4]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostSteals integer, -- post season steals, example: [0, 20]\n PostBlocks integer, -- post season blocks, example: [0, 1]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeMade integer, -- post season three point made, example: [0, 12]\n note text, -- example: ['C']\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n tmID text, -- team ID, example: ['AFS', 'AGW']\n franchID text, -- example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n divID text, -- division ID, example: ['EA', 'WE']\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n d_pts integer, -- defense points, example: [578, 498]\n homeLost integer, -- home loses, example: [1, 2]\n awayWon integer, -- away wins, example: [5, 1]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n first_name text, -- example: ['Kareem', 'Shareef']\n season_id integer, -- example: [1969, 1970]\n conference text, -- example: ['East', 'West']\n league_id text, -- example: ['NBA', 'ABA']\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n stint integer, -- example: [2, 1]\n won integer, -- example: [14, 59]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftSelection integer, -- league ID, example: [0, 3]\n draftOverall integer, -- draft overall rank, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe same starting player refers to GP = GS; full name of the team refers to teams.name\nWhich team had the most same starting players througout the season? Give the full name of the team.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n middleName text, -- example: ['Shareef', 'Craig']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n minutes integer, -- example: [290, 934]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftMade integer, -- free throw made, example: [25, 76]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n confRank integer, -- example: [0, 4]\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore than one player refers to count(playerID) > 1; grabbed more than 600 rebounds refers to rebounds > 600; in 2011 refers to 2011; full name refers to teams.name\nWhich team had more than one player who grabbed more than 600 rebounds in 2011? Give the full name of the team.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.tmID FROM teams AS T1 INNER JOIN players_teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.year = 2011 AND T2.rebounds > 600", "style": "rule" }
{ "db_id": "professional_basketball.sqlite", "gt_sql": "SELECT T1.tmID FROM teams AS T1 INNER JOIN players_teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.year = 2011 AND T2.rebounds > 600", "index": 1456, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE series_post (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1946, 1947]\n round text, -- example: ['F', 'QF']\n tmIDWinner text, -- team id winner, example: ['PHW', 'NYK']\n lgIDWinner text, -- league id winner, example: ['NBA', 'ABA']\n tmIDLoser text, -- team id loser, example: ['CHS', 'CLR']\n lgIDLoser text, -- league id loser, example: ['NBA', 'ABA']\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [1, 0]\n PRIMARY KEY (id),\n CONSTRAINT fk_series_post_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_series_post_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES teams (tmID),\n CONSTRAINT fk_series_post_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_players (\n playerID text, -- example: ['abdulka01', 'abdulma02']\n award text, -- example: ['All-Defensive Second Team', 'All-NBA Second Team']\n `year` integer, -- example: [1969, 1970]\n note text, -- example: ['tie']\n pos text, -- position, example: ['C', 'F']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awards_players_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\n\nCREATE TABLE players (\n playerID text, -- example: ['abdelal01', 'abdulka01']\n middleName text, -- example: ['Shareef', 'Craig']\n nameGiven text, -- example: ['nameGiven', 'Mort']\n nameSuffix text, -- example: ['Jr.', 'III']\n nameNick text, -- nick name, example: ['Lew, Cap', 'Walt']\n pos text, -- position, example: ['F-C', 'C']\n lastseason integer, -- example: [0, 1951]\n height real, -- example: [82.0, 85.0]\n weight integer, -- example: [240, 225]\n college text, -- example: ['Duke', 'UCLA']\n collegeOther text, -- example: ['Santa Monica City', 'Michigan']\n birthState text, -- example: ['NY', 'DE']\n birthCountry text, -- example: ['EGY', 'USA']\n highSchool text, -- example: ['Bloomfield Senior', 'Power Memorial']\n hsState text, -- high school state, example: ['NJ', 'NY']\n hsCountry text, -- high school country, example: ['USA', 'FRA']\n deathDate date, -- example: ['0000-00-00', '2011-11-18']\n race text, -- example: ['B', 'W']\n PRIMARY KEY (playerID)\n);\n\nCREATE TABLE draft (\n id integer, -- example: [1, 2]\n draftYear integer, -- example: [1967, 1968]\n draftRound integer, -- example: [0, 1]\n draftSelection integer, -- league ID, example: [0, 3]\n tmID text, -- team ID, example: ['ANA', 'DNR']\n firstName text, -- example: ['Darrell', 'Bob']\n lastName text, -- example: ['Hardy', 'Krulish']\n playerID text, -- example: ['hardyda01', 'lewisbo01']\n draftFrom text, -- example: ['Baylor', 'Pacific']\n lgID text, -- league ID, example: ['ABA', 'NBA']\n PRIMARY KEY (id),\n CONSTRAINT fk_draft_draftyear FOREIGN KEY (draftYear) REFERENCES teams (`year`),\n CONSTRAINT fk_draft_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE awards_coaches (\n id integer, -- example: [1, 2]\n `year` integer, -- example: [1962, 1963]\n coachID text, -- example: ['gallaha01', 'hannual01']\n award text, -- example: ['NBA Coach of the Year', 'ABA Coach of the Year']\n note text, -- example: ['tie']\n PRIMARY KEY (id),\n CONSTRAINT fk_awards_coaches_year FOREIGN KEY (`year`) REFERENCES coaches (`year`),\n CONSTRAINT fk_awards_coaches_coachid FOREIGN KEY (coachID) REFERENCES coaches (coachID)\n);\n\nCREATE TABLE players_teams (\n id integer, -- example: [1, 2]\n playerID text, -- example: ['abdelal01', 'abdulka01']\n `year` integer, -- example: [1990, 1991]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['POR', 'MIL']\n lgID text, -- example: ['NBA', 'NBL']\n GP integer, -- game presentatons, example: [43, 71]\n minutes integer, -- example: [290, 934]\n dRebounds integer, -- defense rebounds, example: [62, 179]\n rebounds integer, -- example: [89, 260]\n blocks integer, -- example: [12, 17]\n turnovers integer, -- example: [22, 66]\n fgAttempted integer, -- field goal attempted, example: [116, 361]\n fgMade integer, -- field goal made, example: [55, 178]\n ftMade integer, -- free throw made, example: [25, 76]\n threeMade integer, -- three point made, example: [0, 1]\n PostGP integer, -- post season game presentations, example: [5, 8]\n PostGS integer, -- post season game starting, example: [0, 6]\n PostMinutes integer, -- post season minutes, example: [13, 25]\n PostPoints integer, -- post season points, example: [4, 12]\n PostAssists integer, -- post season assistants, example: [0, 2]\n PostPF integer, -- post season personal fouls, example: [0, 4]\n PostfgAttempted integer, -- post season field goal attempted, example: [6, 10]\n PostfgMade integer, -- post season field goal made, example: [2, 5]\n PostftAttempted integer, -- post season field free throw attempted, example: [0, 4]\n PostftMade integer, -- post season free throw made, example: [0, 2]\n PostthreeAttempted integer, -- post season three point attempted, example: [0, 1]\n PRIMARY KEY (id),\n CONSTRAINT fk_players_teams_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_players_teams_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE teams (\n `year` integer, -- example: [1937, 1938]\n lgID text, -- league ID, example: ['NBL', 'NBA']\n tmID text, -- team ID, example: ['AFS', 'AGW']\n confID text, -- example: ['EC', 'WC']\n confRank integer, -- example: [0, 4]\n name text, -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots']\n o_fgm integer, -- offense field goal made, example: [249, 243]\n o_ftm integer, -- offense free throw made, example: [183, 159]\n o_pts integer, -- offense points, example: [681, 645]\n d_pts integer, -- defense points, example: [578, 498]\n homeWon integer, -- home wins, example: [8, 2]\n homeLost integer, -- home loses, example: [1, 2]\n awayLost integer, -- away loses, example: [3, 4]\n won integer, -- example: [14, 13]\n lost integer, -- example: [4, 5]\n games integer, -- example: [18, 9]\n arena text, -- example: ['Boston Garden', 'Chicago Stadium']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE coaches (\n coachID text, -- example: ['adelmri01', 'adubari01']\n `year` integer, -- example: [1988, 1989]\n tmID text, -- team ID, example: ['POR', 'GSW']\n lgID text, -- league ID, example: ['NBA', 'ABA']\n stint integer, -- example: [2, 1]\n lost integer, -- example: [21, 23]\n post_wins integer, -- post season wins, example: [0, 12]\n post_losses integer, -- post season losses, example: [3, 9]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES teams (tmID)\n);\n\nCREATE TABLE player_allstar (\n playerID text, -- example: ['abdulka01', 'abdursh01']\n last_name text, -- example: ['Abdul-Jabbar', 'A-Rahim']\n season_id integer, -- example: [1969, 1970]\n games_played integer, -- example: [1]\n minutes integer, -- example: [18, 30]\n points integer, -- example: [10, 19]\n o_rebounds integer, -- offense rebounds, example: [1, 2]\n d_rebounds integer, -- defense rebounds, example: [2, 5]\n rebounds integer, -- example: [11, 14]\n assists integer, -- assistants, example: [4, 1]\n steals integer, -- example: [3, 0]\n blocks integer, -- example: [2, 0]\n turnovers integer, -- example: [1, 0]\n personal_fouls integer, -- example: [3, 2]\n fg_attempted integer, -- field goal attempted, example: [8, 16]\n fg_made integer, -- field goal made, example: [4, 8]\n ft_attempted integer, -- free throw attempted, example: [2, 4]\n ft_made integer, -- free throw made, example: [2, 3]\n three_attempted integer, -- three point attempted, example: [0, 1]\n three_made integer, -- three point made, example: [0, 1]\n PRIMARY KEY (playerID, season_id),\n CONSTRAINT fk_player_allstar_playerid FOREIGN KEY (playerID) REFERENCES players (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore than one player refers to count(playerID) > 1; grabbed more than 600 rebounds refers to rebounds > 600; in 2011 refers to 2011; full name refers to teams.name\nWhich team had more than one player who grabbed more than 600 rebounds in 2011? Give the full name of the team.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['First Apparition', 'First Citizen']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTwelfth Night refers to Title = 'Twelfth Night'\nHow many scenes are there in Act 1 in Twelfth Night?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T1.id) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T2.Act = 1 AND T1.Title = 'Twelfth Night'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT COUNT(T1.id) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T2.Act = 1 AND T1.Title = 'Twelfth Night'", "index": 1457, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['First Apparition', 'First Citizen']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTwelfth Night refers to Title = 'Twelfth Night'\nHow many scenes are there in Act 1 in Twelfth Night?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['All', 'First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncharacter names refers to CharName; Twelfth Night refers to Title = 'Twelfth Night'\nPlease list the character names of all the characters from the work Twelfth Night.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT T4.CharName FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id INNER JOIN characters AS T4 ON T3.character_id = T4.id WHERE T1.Title = 'Twelfth Night'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT DISTINCT T4.CharName FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id INNER JOIN characters AS T4 ON T3.character_id = T4.id WHERE T1.Title = 'Twelfth Night'", "index": 1458, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['All', 'First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncharacter names refers to CharName; Twelfth Night refers to Title = 'Twelfth Night'\nPlease list the character names of all the characters from the work Twelfth Night.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTwelfth Night refers to Title = 'Twelfth Night'\nHow many paragraphs are there in Act 1, Scene 1 in Twelfth Night?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(T3.ParagraphNum) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id WHERE T2.Act = 1 AND T2.Scene = 1 AND T1.Title = 'Twelfth Night'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT SUM(T3.ParagraphNum) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id WHERE T2.Act = 1 AND T2.Scene = 1 AND T1.Title = 'Twelfth Night'", "index": 1459, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTwelfth Night refers to Title = 'Twelfth Night'\nHow many paragraphs are there in Act 1, Scene 1 in Twelfth Night?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['Lord Abergavenny', 'First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['ABERGAVENNY', 'LORD', 'First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLord Abergavenny refers to CharName = 'Lord Abergavenny'\nHow many paragraphs contain the character Lord Abergavenny?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(T1.ParagraphNum) FROM paragraphs AS T1 INNER JOIN characters AS T2 ON T1.character_id = T2.id WHERE T2.CharName = 'Lord Abergavenny'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT SUM(T1.ParagraphNum) FROM paragraphs AS T1 INNER JOIN characters AS T2 ON T1.character_id = T2.id WHERE T2.CharName = 'Lord Abergavenny'", "index": 1460, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['Lord Abergavenny', 'First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['ABERGAVENNY', 'LORD', 'First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLord Abergavenny refers to CharName = 'Lord Abergavenny'\nHow many paragraphs contain the character Lord Abergavenny?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['OLIVIA’s house.', 'OLIVIA’S house.', 'DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['Olivia', 'Time', 'First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"OLIVIA’S house.\"  refers to chapters.Description = 'OLIVIA’S house.'; Twelfth Night refers to Title = 'Twelfth Night'\nFor how many times has the scene \"OLIVIA’S house.\" appeared in Twelfth Night?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.id) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T2.Description = 'OLIVIA’S house.' AND T1.Title = 'Twelfth Night'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT COUNT(T2.id) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T2.Description = 'OLIVIA’S house.' AND T1.Title = 'Twelfth Night'", "index": 1461, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['OLIVIA’s house.', 'OLIVIA’S house.', 'DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['Olivia', 'Time', 'First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"OLIVIA’S house.\"  refers to chapters.Description = 'OLIVIA’S house.'; Twelfth Night refers to Title = 'Twelfth Night'\nFor how many times has the scene \"OLIVIA’S house.\" appeared in Twelfth Night?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTwelfth Night refers to Title = 'Twelfth Night'; average scene = divide(sum(Scene), count(Act))\nHow many scenes are there on average in one act in Twelfth Night?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Scene) / COUNT(T2.Act) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T1.Title = 'Twelfth Night'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT SUM(T2.Scene) / COUNT(T2.Act) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T1.Title = 'Twelfth Night'", "index": 1462, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTwelfth Night refers to Title = 'Twelfth Night'; average scene = divide(sum(Scene), count(Act))\nHow many scenes are there on average in one act in Twelfth Night?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost paragraphs refers to max(count(chapter_id))\nWhich chapter has the most paragraphs? Give the description of the chapter.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Description FROM chapters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.chapter_id ORDER BY T2.ParagraphNum DESC LIMIT 1", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT T1.Description FROM chapters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.chapter_id ORDER BY T2.ParagraphNum DESC LIMIT 1", "index": 1463, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost paragraphs refers to max(count(chapter_id))\nWhich chapter has the most paragraphs? Give the description of the chapter.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n PlainText text, -- example: ['Mistress?', 'Mistress!', '[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nparagraph \"Would he do so, I'ld beg your precious mistress, Which he counts but a trifle.\"  refers to PlainText = 'Would he do so, I'ld beg your precious mistress, Which he counts but a trifle.'\nWhich character was mentioned in the paragraph \"Would he do so, I'ld beg your precious mistress, Which he counts but a trifle.\"? Give the character name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.CharName FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T2.PlainText = 'Would he do so, I''ld beg your precious mistress,Which he counts but a trifle.'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT T1.CharName FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T2.PlainText = 'Would he do so, I''ld beg your precious mistress,Which he counts but a trifle.'", "index": 1464, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n PlainText text, -- example: ['Mistress?', 'Mistress!', '[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nparagraph \"Would he do so, I'ld beg your precious mistress, Which he counts but a trifle.\"  refers to PlainText = 'Would he do so, I'ld beg your precious mistress, Which he counts but a trifle.'\nWhich character was mentioned in the paragraph \"Would he do so, I'ld beg your precious mistress, Which he counts but a trifle.\"? Give the character name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Titus Andronicus', 'Twelfth Night', \"All's Well That Ends Well\"]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTitus Andronicus refers to Title = 'Titus Andronicus'\nHow many characters are there in Titus Andronicus?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 T3.character_id) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id WHERE T1.Title = 'Titus Andronicus'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T3.character_id) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id WHERE T1.Title = 'Titus Andronicus'", "index": 1465, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Titus Andronicus', 'Twelfth Night', \"All's Well That Ends Well\"]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTitus Andronicus refers to Title = 'Titus Andronicus'\nHow many characters are there in Titus Andronicus?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['Gentlemen', 'First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['Gentlemen', 'GENTLEMEN', 'First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['Gentlemen!', '[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Two Gentlemen of Verona', 'Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Two Gentlemen of Verona', 'Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTwo Gentlemen of Verona refers to LongTitle = 'Two Gentlemen of Verona'\nList the number of acts in Two Gentlemen of Verona.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Act FROM chapters AS T1 INNER JOIN works AS T2 ON T1.id = T1.work_id WHERE T2.LongTitle = 'Two Gentlemen of Verona'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT DISTINCT T1.Act FROM chapters AS T1 INNER JOIN works AS T2 ON T1.id = T1.work_id WHERE T2.LongTitle = 'Two Gentlemen of Verona'", "index": 1466, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['Gentlemen', 'First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['Gentlemen', 'GENTLEMEN', 'First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['Gentlemen!', '[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Two Gentlemen of Verona', 'Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Two Gentlemen of Verona', 'Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTwo Gentlemen of Verona refers to LongTitle = 'Two Gentlemen of Verona'\nList the number of acts in Two Gentlemen of Verona.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['Caesar', 'First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich Shakespeare story with character ID 324 has description of 'this friend of Caesar'?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Title FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id INNER JOIN characters AS T4 ON T3.character_id = T4.id WHERE T2.id = '324' AND T2.Description = 'friend to Caesar'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT T1.Title FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id INNER JOIN characters AS T4 ON T3.character_id = T4.id WHERE T2.id = '324' AND T2.Description = 'friend to Caesar'", "index": 1467, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['Caesar', 'First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich Shakespeare story with character ID 324 has description of 'this friend of Caesar'?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n Abbrev text, -- abbreviation, example: ['First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many paragraphs are there in the scene whose description is \"A Sea-port in Cyprus. An open place near the quay.\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.ParagraphNum) FROM chapters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.chapter_id WHERE T1.Description = 'A Sea-port in Cyprus. An open place near the quay.'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT SUM(T2.ParagraphNum) FROM chapters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.chapter_id WHERE T1.Description = 'A Sea-port in Cyprus. An open place near the quay.'", "index": 1468, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n Abbrev text, -- abbreviation, example: ['First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many paragraphs are there in the scene whose description is \"A Sea-port in Cyprus. An open place near the quay.\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['All', 'First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['ALL', 'All', 'First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Tragedy', 'Comedy']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntragic scenes refers to GenreType = 'Tragedy'; work in 1594 refers to Date = '1594'; percentage = divide((sum(Scene) when GenreType = 'Tragedy'), count(Scene))as percentage\nWhat percentage of all scenes are tragic scenes in Shakespeare's work in 1594?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(IIF(T2.GenreType = 'Tragedy', 1, 0)) AS REAL) * 100 / COUNT(T1.Scene) FROM chapters AS T1 INNER JOIN works AS T2 ON T1.work_id = T2.id WHERE T2.Date = '1594'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT CAST(SUM(IIF(T2.GenreType = 'Tragedy', 1, 0)) AS REAL) * 100 / COUNT(T1.Scene) FROM chapters AS T1 INNER JOIN works AS T2 ON T1.work_id = T2.id WHERE T2.Date = '1594'", "index": 1469, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['All', 'First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['ALL', 'All', 'First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Tragedy', 'Comedy']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntragic scenes refers to GenreType = 'Tragedy'; work in 1594 refers to Date = '1594'; percentage = divide((sum(Scene) when GenreType = 'Tragedy'), count(Scene))as percentage\nWhat percentage of all scenes are tragic scenes in Shakespeare's work in 1594?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n Description text, -- example: ['servant to Timon', 'A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n character_id integer, -- example: [1261, 840]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nservant to Timon refers to characters.Description = 'servant to Timon'\nHow many \"servant to Timon\" characters are there?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(id) FROM characters WHERE Description = 'servant to Timon'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT COUNT(id) FROM characters WHERE Description = 'servant to Timon'", "index": 1470, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n Description text, -- example: ['servant to Timon', 'A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n character_id integer, -- example: [1261, 840]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nservant to Timon refers to characters.Description = 'servant to Timon'\nHow many \"servant to Timon\" characters are there?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many scenes are there in work id 7, act 1?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(id) FROM chapters WHERE work_id = 7 AND Act = 1", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT COUNT(id) FROM chapters WHERE work_id = 7 AND Act = 1", "index": 1471, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many scenes are there in work id 7, act 1?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['Capulet', 'First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['Daughter', 'CAPULET', 'First Apparition', 'First Citizen']\n Description text, -- example: ['Daughter to Capulet', 'A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndaughter of Capulet refers to characters.Description = 'Daughter to Capulet'\nWho is the daughter of Capulet?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CharName FROM characters WHERE Description = 'Daughter to Capulet'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT CharName FROM characters WHERE Description = 'Daughter to Capulet'", "index": 1472, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['Capulet', 'First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['Daughter', 'CAPULET', 'First Apparition', 'First Citizen']\n Description text, -- example: ['Daughter to Capulet', 'A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndaughter of Capulet refers to characters.Description = 'Daughter to Capulet'\nWho is the daughter of Capulet?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Ay, surely, mere the truth: I know his lady.\" refers to PlainText = 'Ay, surely, mere the truth: I know his lady.'\nHow many paragraphs are there in \"Ay, surely, mere the truth: I know his lady.\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT ParagraphNum FROM paragraphs WHERE PlainText = 'Ay, surely, mere the truth: I know his lady.'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT ParagraphNum FROM paragraphs WHERE PlainText = 'Ay, surely, mere the truth: I know his lady.'", "index": 1473, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Ay, surely, mere the truth: I know his lady.\" refers to PlainText = 'Ay, surely, mere the truth: I know his lady.'\nHow many paragraphs are there in \"Ay, surely, mere the truth: I know his lady.\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest number of scenes refers to max(count(Scene))\nWhat is the long title of the work with the highest number of scenes in act 1?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.LongTitle FROM chapters AS T1 INNER JOIN works AS T2 ON T1.work_id = T2.id WHERE T1.Act = 1 ORDER BY T1.Scene DESC LIMIT 1", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT T2.LongTitle FROM chapters AS T1 INNER JOIN works AS T2 ON T1.work_id = T2.id WHERE T1.Act = 1 ORDER BY T1.Scene DESC LIMIT 1", "index": 1474, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest number of scenes refers to max(count(Scene))\nWhat is the long title of the work with the highest number of scenes in act 1?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['What is the name?', '[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['The sea-coast.', 'DUKE ORSINO’s palace.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['(stage directions)', 'Time', 'First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['Other', 'Time', 'First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOther than \"stage directions\" refers to CharName ! = '(stage directions)'; name of the character refers to CharName; appeared 5 times in \"the sea-coast\" refers to chapters.Description = 'The sea-coast.' and count(character_id) = 5\nOther than \"stage directions\", what is the name of the character that appeared 5 times in \"the sea-coast\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.CharName FROM ( SELECT T3.CharName, COUNT(T3.id) AS num FROM paragraphs AS T1 INNER JOIN chapters AS T2 ON T1.chapter_id = T2.id INNER JOIN characters AS T3 ON T1.character_id = T3.id WHERE T2.Description = 'The sea-coast.' AND T3.CharName != '(stage directions)' AND T1.chapter_id = 18709 GROUP BY T3.id, T3.CharName ) AS T WHERE T.num = 5", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT T.CharName FROM ( SELECT T3.CharName, COUNT(T3.id) AS num FROM paragraphs AS T1 INNER JOIN chapters AS T2 ON T1.chapter_id = T2.id INNER JOIN characters AS T3 ON T1.character_id = T3.id WHERE T2.Description = 'The sea-coast.' AND T3.CharName != '(stage directions)' AND T1.chapter_id = 18709 GROUP BY T3.id, T3.CharName ) AS T WHERE T.num = 5", "index": 1475, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['What is the name?', '[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['The sea-coast.', 'DUKE ORSINO’s palace.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['(stage directions)', 'Time', 'First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['Other', 'Time', 'First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOther than \"stage directions\" refers to CharName ! = '(stage directions)'; name of the character refers to CharName; appeared 5 times in \"the sea-coast\" refers to chapters.Description = 'The sea-coast.' and count(character_id) = 5\nOther than \"stage directions\", what is the name of the character that appeared 5 times in \"the sea-coast\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['No more!', 'No more?', 'No more.', '[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n Abbrev text, -- abbreviation, example: ['First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['As You Like It', 'Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['As You Like It', 'Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"As You Like It\" refers to Title = 'As You Like It' ;paragraph number of no more than 50 refers to ParagraphNum < 50\nAmong the chapters in \"As You Like It\", how many chapters have a paragraph number of no more than 50?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T3.chapter_id) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id WHERE T1.Title = 'As You Like It' AND T3.ParagraphNum < 50", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT COUNT(T3.chapter_id) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id WHERE T1.Title = 'As You Like It' AND T3.ParagraphNum < 50", "index": 1476, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['No more!', 'No more?', 'No more.', '[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n Abbrev text, -- abbreviation, example: ['First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['As You Like It', 'Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['As You Like It', 'Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"As You Like It\" refers to Title = 'As You Like It' ;paragraph number of no more than 50 refers to ParagraphNum < 50\nAmong the chapters in \"As You Like It\", how many chapters have a paragraph number of no more than 50?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['His name, I pray you.', 'I pray you.', '[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Florence. Without the walls. A tucket afar off\" refers to chapters.Description = 'Florence. Without the walls. A tucket afar off.'; \"His name, I pray you.\" refers to PlainText = 'His name, I pray you.'\nIn \"Florence. Without the walls. A tucket afar off\", what is the id of the character that was mentioned in \"His name, I pray you.\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.character_id FROM paragraphs AS T1 INNER JOIN chapters AS T2 ON T1.chapter_id = T2.id WHERE T1.PlainText = 'His name, I pray you.' AND T2.Description = 'Florence. Without the walls. A tucket afar off.'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT T1.character_id FROM paragraphs AS T1 INNER JOIN chapters AS T2 ON T1.chapter_id = T2.id WHERE T1.PlainText = 'His name, I pray you.' AND T2.Description = 'Florence. Without the walls. A tucket afar off.'", "index": 1477, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['His name, I pray you.', 'I pray you.', '[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Florence. Without the walls. A tucket afar off\" refers to chapters.Description = 'Florence. Without the walls. A tucket afar off.'; \"His name, I pray you.\" refers to PlainText = 'His name, I pray you.'\nIn \"Florence. Without the walls. A tucket afar off\", what is the id of the character that was mentioned in \"His name, I pray you.\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['Hamlet', 'First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Hamlet', 'Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHamlet refers to Title = 'Hamlet'\nHow many characters are there in Hamlet?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 T3.character_id) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id WHERE T1.Title = 'Hamlet'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T3.character_id) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id WHERE T1.Title = 'Hamlet'", "index": 1478, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['Hamlet', 'First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Hamlet', 'Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHamlet refers to Title = 'Hamlet'\nHow many characters are there in Hamlet?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Sonnets', 'Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Sonnets', 'Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Sonnet', 'Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n Abbrev text, -- abbreviation, example: ['First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSonnets refers to Title = 'Sonnets'\nHow many acts are there in Sonnets?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(DISTINCT T2.Act) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T1.Title = 'Sonnets'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT SUM(DISTINCT T2.Act) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T1.Title = 'Sonnets'", "index": 1479, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Sonnets', 'Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Sonnets', 'Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Sonnet', 'Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n Abbrev text, -- abbreviation, example: ['First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSonnets refers to Title = 'Sonnets'\nHow many acts are there in Sonnets?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['1Play', 'First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nabbreviated name is 1Play; appeared first refers to Abbrev = '1Play' and min(chapter_id)\nWhat is the description of the chapter where the character whose abrreviated name is 1Play appeared first?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.Description FROM paragraphs AS T1 INNER JOIN chapters AS T2 ON T1.chapter_id = T2.id INNER JOIN characters AS T3 ON T1.character_id = T3.id WHERE T3.Abbrev = '1Play' ORDER BY T1.chapter_id LIMIT 1", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT T2.Description FROM paragraphs AS T1 INNER JOIN chapters AS T2 ON T1.chapter_id = T2.id INNER JOIN characters AS T3 ON T1.character_id = T3.id WHERE T3.Abbrev = '1Play' ORDER BY T1.chapter_id LIMIT 1", "index": 1480, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['1Play', 'First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nabbreviated name is 1Play; appeared first refers to Abbrev = '1Play' and min(chapter_id)\nWhat is the description of the chapter where the character whose abrreviated name is 1Play appeared first?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\none-act works refers to count(Act) = 1; genre refers to GenreType\n\nWhat are the titles and genres of the one-act works of Shakespeare?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Title, T1.GenreType FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T2.Act = 1", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT DISTINCT T1.Title, T1.GenreType FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T2.Act = 1", "index": 1481, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\none-act works refers to count(Act) = 1; genre refers to GenreType\n\nWhat are the titles and genres of the one-act works of Shakespeare?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncomedy refers to GenreType = 'Comedy'; average = divide(sum(count(Scene)), count(work.id))\nOn average, how many scenes are there in each of the comedy works written by Shakespeare?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(T2.Scene) AS REAL) / COUNT(T1.id) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T1.GenreType = 'Comedy'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT CAST(SUM(T2.Scene) AS REAL) / COUNT(T1.id) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T1.GenreType = 'Comedy'", "index": 1482, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncomedy refers to GenreType = 'Comedy'; average = divide(sum(count(Scene)), count(work.id))\nOn average, how many scenes are there in each of the comedy works written by Shakespeare?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['Juliet', 'Romeo', 'First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['JULIET', 'ROMEO', 'First Apparition', 'First Citizen']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Romeo and Juliet', 'Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['The Tragedy of Romeo and Juliet', 'Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Tragedy', 'Comedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRome and Juliet refers to CharName = 'Romeo' and CharName = 'Juliet'; The Tragedy of Romeo and Juliet refers to LongTitle = 'The Tragedy of Romeo and Juliet'; percentage = divide(sum(charater.id) when CharName = 'Romeo', sum(charater.id)) as percentage and percentage = divide(sum(charater.id) when CharName = 'Juliet', count(charater.id)) as percentage\nBetween Rome and Juliet, which character was mentioned the most in the The Tragedy of Romeo and Juliet? Calculate for Romeo and Juliet's individual amount of appearance in percentage against the overall number of characters that appeared in the said work.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(IIF(T4.CharName = 'Romeo', 1, 0)), SUM(IIF(T4.CharName = 'Juliet', 1, 0)), CAST(SUM(IIF(T4.CharName = 'Romeo', 1, 0)) + SUM(IIF(T4.CharName = 'Juliet', 1, 0)) AS REAL) * 100 / COUNT(T1.id) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id INNER JOIN characters AS T4 ON T3.character_id = T4.id", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT SUM(IIF(T4.CharName = 'Romeo', 1, 0)), SUM(IIF(T4.CharName = 'Juliet', 1, 0)), CAST(SUM(IIF(T4.CharName = 'Romeo', 1, 0)) + SUM(IIF(T4.CharName = 'Juliet', 1, 0)) AS REAL) * 100 / COUNT(T1.id) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id INNER JOIN characters AS T4 ON T3.character_id = T4.id", "index": 1483, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['Juliet', 'Romeo', 'First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['JULIET', 'ROMEO', 'First Apparition', 'First Citizen']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Romeo and Juliet', 'Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['The Tragedy of Romeo and Juliet', 'Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Tragedy', 'Comedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRome and Juliet refers to CharName = 'Romeo' and CharName = 'Juliet'; The Tragedy of Romeo and Juliet refers to LongTitle = 'The Tragedy of Romeo and Juliet'; percentage = divide(sum(charater.id) when CharName = 'Romeo', sum(charater.id)) as percentage and percentage = divide(sum(charater.id) when CharName = 'Juliet', count(charater.id)) as percentage\nBetween Rome and Juliet, which character was mentioned the most in the The Tragedy of Romeo and Juliet? Calculate for Romeo and Juliet's individual amount of appearance in percentage against the overall number of characters that appeared in the said work.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['This is Illyria, lady.', '[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nparagraph number refers to ParagraphNum\nWhat is the paragraph number with plain text \"This is Illyria, lady\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT ParagraphNum FROM paragraphs WHERE PlainText = 'This is Illyria, lady.'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT ParagraphNum FROM paragraphs WHERE PlainText = 'This is Illyria, lady.'", "index": 1484, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['This is Illyria, lady.', '[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nparagraph number refers to ParagraphNum\nWhat is the paragraph number with plain text \"This is Illyria, lady\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n Abbrev text, -- abbreviation, example: ['First Apparition', 'First Citizen']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many scenes are there in Act 5 of work ID 9?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(Scene) FROM chapters WHERE work_id = 9 AND Act = 5", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT COUNT(Scene) FROM chapters WHERE work_id = 9 AND Act = 5", "index": 1485, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n Abbrev text, -- abbreviation, example: ['First Apparition', 'First Citizen']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many scenes are there in Act 5 of work ID 9?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncharacter names refers to CharName\nList the character names and descriptions of chapter ID 18710.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.CharName, T1.Description FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T2.Chapter_id = 18710", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT DISTINCT T1.CharName, T1.Description FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T2.Chapter_id = 18710", "index": 1486, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncharacter names refers to CharName\nList the character names and descriptions of chapter ID 18710.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: [\"Midsummer Night's Dream\", 'Twelfth Night', \"All's Well That Ends Well\"]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['First Apparition', 'First Citizen']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin \"Midsummer Night's Dream\" refers to Title = 'Midsummer Night's Dream'\nHow many chapters are there in \"Midsummer Night's Dream\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.id) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T1.Title = 'Midsummer Night''s Dream'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT COUNT(T2.id) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T1.Title = 'Midsummer Night''s Dream'", "index": 1487, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: [\"Midsummer Night's Dream\", 'Twelfth Night', \"All's Well That Ends Well\"]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['First Apparition', 'First Citizen']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin \"Midsummer Night's Dream\" refers to Title = 'Midsummer Night's Dream'\nHow many chapters are there in \"Midsummer Night's Dream\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['Froth', 'First Apparition', 'First Citizen']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncharacter named \"Froth\" refers to CharName = 'Froth'\nWhat is the title which has character named \"Froth\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.title FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id INNER JOIN characters AS T4 ON T3.character_id = T4.id WHERE T4.CharName = 'Froth'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT DISTINCT T1.title FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id INNER JOIN characters AS T4 ON T3.character_id = T4.id WHERE T4.CharName = 'Froth'", "index": 1488, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['Froth', 'First Apparition', 'First Citizen']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncharacter named \"Froth\" refers to CharName = 'Froth'\nWhat is the title which has character named \"Froth\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Witch', 'First Apparition', 'First Citizen']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncharacter name \"First Witch\" refers to CharName = 'First Witch'\nHow many chapters include the character name \"First Witch\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.chapter_id) FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T1.CharName = 'First Witch'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT COUNT(T2.chapter_id) FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T1.CharName = 'First Witch'", "index": 1489, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Witch', 'First Apparition', 'First Citizen']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncharacter name \"First Witch\" refers to CharName = 'First Witch'\nHow many chapters include the character name \"First Witch\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['The house of ANTIPHOLUS of Ephesus.', 'DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['Antipholus of Ephesus', 'First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['ANTIPHOLUS OF EPHESUS', 'First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDescribe the scene number, act, and title of work which had the description of \"The house of ANTIPHOLUS of Ephesus\" in chapter.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Act, T2.Scene, T1.Title FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T2.Description = 'The house of ANTIPHOLUS of Ephesus.'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT T2.Act, T2.Scene, T1.Title FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T2.Description = 'The house of ANTIPHOLUS of Ephesus.'", "index": 1490, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['The house of ANTIPHOLUS of Ephesus.', 'DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['Antipholus of Ephesus', 'First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['ANTIPHOLUS OF EPHESUS', 'First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDescribe the scene number, act, and title of work which had the description of \"The house of ANTIPHOLUS of Ephesus\" in chapter.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['All', 'First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['ALL', 'All', 'First Apparition', 'First Citizen']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncharacter names refers to CharName;\"all\" abbreviation refers to Abbrev = 'all'\nHow many \"all\" character names have the \"all\" abbreviation?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(id) FROM characters WHERE Abbrev = 'All'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT COUNT(id) FROM characters WHERE Abbrev = 'All'", "index": 1491, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['All', 'First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['ALL', 'All', 'First Apparition', 'First Citizen']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncharacter names refers to CharName;\"all\" abbreviation refers to Abbrev = 'all'\nHow many \"all\" character names have the \"all\" abbreviation?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncomedic works refers to GenreType = 'comedy'\nPlease name any three comedic works.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Title FROM works WHERE GenreType = 'comedy' LIMIT 3", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT Title FROM works WHERE GenreType = 'comedy' LIMIT 3", "index": 1492, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncomedic works refers to GenreType = 'comedy'\nPlease name any three comedic works.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['Senator', 'First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'of Venice', 'Senator', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncharacter names refers to CharName; a senator of Venice refers to characters.Description = 'a senator of Venice'\nWhat are the character names for a senator of Venice?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CharName FROM characters WHERE Description = 'a senator of Venice'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT CharName FROM characters WHERE Description = 'a senator of Venice'", "index": 1493, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['Senator', 'First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'of Venice', 'Senator', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncharacter names refers to CharName; a senator of Venice refers to characters.Description = 'a senator of Venice'\nWhat are the character names for a senator of Venice?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['What is the name?', '[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the character refers to CharName; paragraph 8 refers to ParagraphNum = 8; chapter 18820 refers to chapter_id = 18820\nWhat is the name of the character that can be found in paragraph 8 of chapter 18820?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.CharName FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T2.ParagraphNum = 8 AND T2.chapter_id = 18820", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT T1.CharName FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T2.ParagraphNum = 8 AND T2.chapter_id = 18820", "index": 1494, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['What is the name?', '[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the character refers to CharName; paragraph 8 refers to ParagraphNum = 8; chapter 18820 refers to chapter_id = 18820\nWhat is the name of the character that can be found in paragraph 8 of chapter 18820?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Twelfth Night, Or What You Will\" refers to LongTitle\nHow many scenes can be found in \"Twelfth Night, Or What You Will\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Scene) AS cnt FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T1.LongTitle = 'Cymbeline, King of Britain'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT COUNT(T2.Scene) AS cnt FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T1.LongTitle = 'Cymbeline, King of Britain'", "index": 1495, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Twelfth Night, Or What You Will\" refers to LongTitle\nHow many scenes can be found in \"Twelfth Night, Or What You Will\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncharacter names refers to CharName; paragraph 3 refers to ParagraphNum = 3\nWhat are the character names in paragraph 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 DISTINCT T1.CharName FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T2.ParagraphNum = 3", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT DISTINCT T1.CharName FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T2.ParagraphNum = 3", "index": 1496, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncharacter names refers to CharName; paragraph 3 refers to ParagraphNum = 3\nWhat are the character names in paragraph 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 works (\n id integer, -- example: [1, 2]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['Sir Andrew Aguecheek', 'First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nparagraph number refers to ParagraphNum; character named \"Sir Andrew Aguecheek\" refers to CharName = 'Sir Andrew Aguecheek'\nList the paragraph number and paragraphs said by the character named \"Sir Andrew Aguecheek\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.ParagraphNum, T2.id FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T1.CharName = 'Sir Andrew Aguecheek'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT T2.ParagraphNum, T2.id FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T1.CharName = 'Sir Andrew Aguecheek'", "index": 1497, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n `Date` integer, -- character id, example: [1599, 1602]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['Sir Andrew Aguecheek', 'First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nparagraph number refers to ParagraphNum; character named \"Sir Andrew Aguecheek\" refers to CharName = 'Sir Andrew Aguecheek'\nList the paragraph number and paragraphs said by the character named \"Sir Andrew Aguecheek\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['Mytilene. A street before the brothel.', 'A Street.', 'A street.', 'DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndescribed as \"Mytilene. A street before the brothel.\" refers to chapters.Description = 'Mytilene. A street before the brothel.'\nWhat is the long title of the Shakespeare's work with Act 4 Scene 5 described as \"Mytilene. A street before the brothel.\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.LongTitle FROM works AS T1 RIGHT JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T2.Description = 'Mytilene. A street before the brothel.'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT T1.LongTitle FROM works AS T1 RIGHT JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T2.Description = 'Mytilene. A street before the brothel.'", "index": 1498, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n PlainText text, -- example: ['[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n Description text, -- example: ['Mytilene. A street before the brothel.', 'A Street.', 'A street.', 'DUKE ORSINO’s palace.', 'The sea-coast.']\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n LongTitle text, -- example: ['Twelfth Night, Or What You Will', \"All's Well That Ends Well\"]\n `Date` integer, -- character id, example: [1599, 1602]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndescribed as \"Mytilene. A street before the brothel.\" refers to chapters.Description = 'Mytilene. A street before the brothel.'\nWhat is the long title of the Shakespeare's work with Act 4 Scene 5 described as \"Mytilene. A street before the brothel.\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['Lady', 'First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['Lady', 'First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['This is Illyria, lady.', '[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncharacter refers to CharName; \"This is Illyria, lady.\" refers to PlainText = 'This is Illyria, lady.'\nWho is the character that said \"This is Illyria, lady.\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.CharName FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T2.PlainText = 'This is Illyria, lady.'", "style": "rule" }
{ "db_id": "shakespeare.sqlite", "gt_sql": "SELECT T1.CharName FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T2.PlainText = 'This is Illyria, lady.'", "index": 1499, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE characters (\n id integer, -- example: [1, 2]\n CharName text, -- example: ['Lady', 'First Apparition', 'First Citizen']\n Abbrev text, -- abbreviation, example: ['Lady', 'First Apparition', 'First Citizen']\n Description text, -- example: ['A senator of Venice', 'a Moor, beloved by Tamora']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE paragraphs (\n id integer, -- example: [630863, 630864]\n ParagraphNum integer, -- paragraph number, example: [3, 4]\n PlainText text, -- example: ['This is Illyria, lady.', '[Enter DUKE ORSINO, CURIO, and other Lor', 'If music be the food of love, play on;\\nG']\n character_id integer, -- example: [1261, 840]\n chapter_id integer, -- example: [18704, 18705]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE works (\n id integer, -- example: [1, 2]\n Title text, -- example: ['Twelfth Night', \"All's Well That Ends Well\"]\n GenreType text, -- example: ['Comedy', 'Tragedy']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE chapters (\n id integer, -- example: [18704, 18705]\n Act integer, -- example: [1, 2]\n Scene integer, -- example: [1, 2]\n work_id integer, -- example: [1, 2]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncharacter refers to CharName; \"This is Illyria, lady.\" refers to PlainText = 'This is Illyria, lady.'\nWho is the character that said \"This is Illyria, lady.\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }