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 Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postt text, -- post-season ties, example: ['0', '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 Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHL', 'NHA']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['NHL', 'PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_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:\nfirst season in NHL in before 1950 refers to firstNHL<1950; goalies who are still alive refers to deathYear IS NOT NULL\nAmong all goalies who are still alive, whose first season in NHL in before 1950. List the team names they were 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.name FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID INNER JOIN Teams AS T3 ON T2.lgID = T3.lgID AND T2.year = T3.year WHERE T1.deathYear IS NOT NULL AND T1.firstNHL < 1950", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT DISTINCT T3.name FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID INNER JOIN Teams AS T3 ON T2.lgID = T3.lgID AND T2.year = T3.year WHERE T1.deathYear IS NOT NULL AND T1.firstNHL < 1950", "index": 3600, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postt text, -- post-season ties, example: ['0', '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 Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHL', 'NHA']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['NHL', 'PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_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:\nfirst season in NHL in before 1950 refers to firstNHL<1950; goalies who are still alive refers to deathYear IS NOT NULL\nAmong all goalies who are still alive, whose first season in NHL in before 1950. List the team names they were 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 abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['DET', 'WIN', 'VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['DET', 'WIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['DET', 'WIN', 'TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['DET', 'WIN', 'COB', 'HAI']\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n OctOL text, -- October overtime loses, example: ['1', '0']\n DecW text, -- December wins, example: ['0', '1']\n AprT text, -- April ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['DET', 'WIN', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n SHA text, -- Shorthanded assists, example: ['0', '1']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['DET', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['DET', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['DET', 'WIN', 'CHI']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postt text, -- post-season ties, example: ['0', '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 Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameGiven text, -- example: ['Antti', 'Bruce']\n birthMon text, -- birth Month, example: ['3', '8']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PPG text, -- Power play goals, example: ['28', '51']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['DET', 'WIN', 'BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n GA text, -- Goals against, example: ['7', '47']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwinning percentage refers to DIVIDE(w,g)*100; team DET refers to tmID = 'DET'\nWhich coach has the best performance for team DET in history? What was the winning percentage? Name the coach and the year he coached.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(T2.W AS REAL) / T2.G, T1.firstName, T1.lastName, T2.year FROM Master AS T1 INNER JOIN Coaches AS T2 ON T1.coachID = T2.coachID INNER JOIN ( SELECT coachID FROM Coaches ORDER BY CAST(w AS REAL) / g DESC LIMIT 1 ) AS T3 ON T2.coachID = T3.coachID", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT CAST(T2.W AS REAL) / T2.G, T1.firstName, T1.lastName, T2.year FROM Master AS T1 INNER JOIN Coaches AS T2 ON T1.coachID = T2.coachID INNER JOIN ( SELECT coachID FROM Coaches ORDER BY CAST(w AS REAL) / g DESC LIMIT 1 ) AS T3 ON T2.coachID = T3.coachID", "index": 3601, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['DET', 'WIN', 'VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['DET', 'WIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['DET', 'WIN', 'TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['DET', 'WIN', 'COB', 'HAI']\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n OctOL text, -- October overtime loses, example: ['1', '0']\n DecW text, -- December wins, example: ['0', '1']\n AprT text, -- April ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['DET', 'WIN', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n SHA text, -- Shorthanded assists, example: ['0', '1']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['DET', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['DET', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['DET', 'WIN', 'CHI']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postt text, -- post-season ties, example: ['0', '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 Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameGiven text, -- example: ['Antti', 'Bruce']\n birthMon text, -- birth Month, example: ['3', '8']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PPG text, -- Power play goals, example: ['28', '51']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['DET', 'WIN', 'BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n GA text, -- Goals against, example: ['7', '47']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwinning percentage refers to DIVIDE(w,g)*100; team DET refers to tmID = 'DET'\nWhich coach has the best performance for team DET in history? What was the winning percentage? Name the coach and the year he coached.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['More', 'Aalto', 'Abbey']\n height text, -- example: ['73', '67']\n shootCatch text, -- example: ['L', 'R']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['W', 'L', 'C', 'D']\n birthYear text, -- example: ['1975', '1951']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['L', 'R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['L', 'A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PPG text, -- Power play goals, example: ['1', '5']\n PKG text, -- Power play goals against, example: ['3', '8']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprT text, -- April ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\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 ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['W', 'C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['W', 'L', 'C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_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:\nlost refers to L; won refers to W\nList all goalies with more lost than won games for two seasons or more. State the name of the player and team he played.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID INNER JOIN Teams AS T3 ON T2.year = T3.year AND T2.tmID = T3.tmID WHERE T1.pos = 'G' AND T2.L > T2.W GROUP BY T1.firstName, T1.lastName, T3.name HAVING COUNT(T3.year) > 2", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT DISTINCT T1.firstName, T1.lastName, T3.name FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID INNER JOIN Teams AS T3 ON T2.year = T3.year AND T2.tmID = T3.tmID WHERE T1.pos = 'G' AND T2.L > T2.W GROUP BY T1.firstName, T1.lastName, T3.name HAVING COUNT(T3.year) > 2", "index": 3602, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['More', 'Aalto', 'Abbey']\n height text, -- example: ['73', '67']\n shootCatch text, -- example: ['L', 'R']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['W', 'L', 'C', 'D']\n birthYear text, -- example: ['1975', '1951']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['L', 'R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['L', 'A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PPG text, -- Power play goals, example: ['1', '5']\n PKG text, -- Power play goals against, example: ['3', '8']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprT text, -- April ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\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 ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['W', 'C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['W', 'L', 'C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_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:\nlost refers to L; won refers to W\nList all goalies with more lost than won games for two seasons or more. State the name of the player and team he played.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['W', 'C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['WIN', 'VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['WIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n shootCatch text, -- example: ['L', 'R']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n hT integer, -- home ties, example: [0, 1]\n rT integer, -- Road ties, example: [0, 1]\n DecW text, -- December wins, example: ['0', '1']\n JanL integer, -- January loses, example: [1, 3]\n MarT text, -- March ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['WIN', 'ANA', 'CIN']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['WIN', 'BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['WIN', 'CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\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 HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngood in both right hand and left hand refers shootCatch IS NULL; winning refers to W; every season he played refers to GP; percentage of winning for every season he played refers to DIVIDE(W,GP)*100\nFor all the goalies born in year 1987, who are good in both right hand and left hand? Calculate his percentage of winning for every season he played.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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, T2.year, CAST(T2.W AS REAL) / T2.GP FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T1.birthYear = 1987 AND T1.shootCatch IS NULL", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T1.firstName, T1.lastName, T2.year, CAST(T2.W AS REAL) / T2.GP FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T1.birthYear = 1987 AND T1.shootCatch IS NULL", "index": 3603, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['W', 'C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['WIN', 'VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['WIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n shootCatch text, -- example: ['L', 'R']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n hT integer, -- home ties, example: [0, 1]\n rT integer, -- Road ties, example: [0, 1]\n DecW text, -- December wins, example: ['0', '1']\n JanL integer, -- January loses, example: [1, 3]\n MarT text, -- March ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['WIN', 'ANA', 'CIN']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['WIN', 'BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['WIN', 'CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\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 HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngood in both right hand and left hand refers shootCatch IS NULL; winning refers to W; every season he played refers to GP; percentage of winning for every season he played refers to DIVIDE(W,GP)*100\nFor all the goalies born in year 1987, who are good in both right hand and left hand? Calculate his percentage of winning for every season he played.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['MIN', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aebisda01', 'aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['MIN', 'ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['G', 'A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['MIN', 'VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['MIN', 'QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aebisda01', 'aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n shootCatch text, -- example: ['L', 'R']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aebisda01', 'aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['HI', 'MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['MIN', 'CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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 ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['G', 'R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepL text, -- September loses, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['aebisda01', 'abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE CombinedShutouts (\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['MIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) 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:\nplayed as goaltender refers to pos = 'G'; time in minutes refers to Min; all his games played refers to GP; average time in minutes refers to DIVIDE(SUM(Min)/SUM(GP))\nWhat is given name for player 'aebisda01'. Calculate the average time in minutes for the all his games played as goaltender.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.nameGiven, CAST(SUM(T2.Min) AS REAL) / SUM(T2.GP) FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T1.playerID = 'aebisda01' GROUP BY T1.nameGiven", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T1.nameGiven, CAST(SUM(T2.Min) AS REAL) / SUM(T2.GP) FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T1.playerID = 'aebisda01' GROUP BY T1.nameGiven", "index": 3604, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['MIN', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aebisda01', 'aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['MIN', 'ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['G', 'A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['MIN', 'VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['MIN', 'QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aebisda01', 'aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n shootCatch text, -- example: ['L', 'R']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aebisda01', 'aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['HI', 'MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['MIN', 'CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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 ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['G', 'R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepL text, -- September loses, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['aebisda01', 'abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE CombinedShutouts (\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['MIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) 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:\nplayed as goaltender refers to pos = 'G'; time in minutes refers to Min; all his games played refers to GP; average time in minutes refers to DIVIDE(SUM(Min)/SUM(GP))\nWhat is given name for player 'aebisda01'. Calculate the average time in minutes for the all his games played as goaltender.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['WIN', 'CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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 CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['WIN', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['W', 'C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPA text, -- Power play assists, example: ['0', '1']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['WIN', 'VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['WIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameGiven text, -- example: ['Antti', 'Bruce']\n shootCatch text, -- example: ['L', 'R']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['W', 'C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['WIN', 'BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) 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:\nwins refers to W; all games played refers to GP;greater than 50% wins among all games played refers to DIVIDE(SUM(W),GP)*100>50\nList all living goalies who have greater than 50% wins among all games played. State their last name and first name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.firstName, T1.lastName FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T1.deathYear IS NOT NULL GROUP BY T1.playerID HAVING CAST(SUM(T2.Min) AS REAL) / SUM(T2.GP) > 0.5", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T1.firstName, T1.lastName FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T1.deathYear IS NOT NULL GROUP BY T1.playerID HAVING CAST(SUM(T2.Min) AS REAL) / SUM(T2.GP) > 0.5", "index": 3605, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['WIN', 'CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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 CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['WIN', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['W', 'C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPA text, -- Power play assists, example: ['0', '1']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['WIN', 'VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['WIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameGiven text, -- example: ['Antti', 'Bruce']\n shootCatch text, -- example: ['L', 'R']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['W', 'C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['WIN', 'BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) 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:\nwins refers to W; all games played refers to GP;greater than 50% wins among all games played refers to DIVIDE(SUM(W),GP)*100>50\nList all living goalies who have greater than 50% wins among all games played. State their last name and first name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['C', 'D']\n birthState text, -- example: ['ON', 'MB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n rL integer, -- Road loses, example: [4, 5]\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n OctW text, -- October wins, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebT integer, -- February ties, example: [0, 1]\n MarT text, -- March ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postl text, -- post-season loses, example: ['4', '5']\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 SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_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:\nawarded after death refers to note = 'posthumous'\nHow many players and coaches are awarded after death?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(note) FROM AwardsMisc WHERE note IS NOT NULL", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT COUNT(note) FROM AwardsMisc WHERE note IS NOT NULL", "index": 3606, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['C', 'D']\n birthState text, -- example: ['ON', 'MB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n rL integer, -- Road loses, example: [4, 5]\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n OctW text, -- October wins, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebT integer, -- February ties, example: [0, 1]\n MarT text, -- March ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postl text, -- post-season loses, example: ['4', '5']\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 SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_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:\nawarded after death refers to note = 'posthumous'\nHow many players and coaches are awarded after death?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNick text, -- Nickname, example: ['G', 'Preacher', 'Taffy']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['G', 'C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['G', 'R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['G', 'C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n GF integer, -- Goals for, example: [79, 77]\n PIM text, -- Penalty minutes, example: ['336', '27']\n PKG text, -- Power play goals against, example: ['45', '43']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['G', 'C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPA text, -- Power play assists, example: ['0', '1']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n PIM text, -- penalty minutes, example: ['59', '68']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_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:\nposition of goalie refers to pos = 'G'\nAmong the players who won an award in the year 1983, how many of them play the position of goalie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(playerID) FROM AwardsPlayers WHERE pos = 'G' AND year = 1983", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT COUNT(playerID) FROM AwardsPlayers WHERE pos = 'G' AND year = 1983", "index": 3607, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNick text, -- Nickname, example: ['G', 'Preacher', 'Taffy']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['G', 'C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['G', 'R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['G', 'C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n GF integer, -- Goals for, example: [79, 77]\n PIM text, -- Penalty minutes, example: ['336', '27']\n PKG text, -- Power play goals against, example: ['45', '43']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['G', 'C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPA text, -- Power play assists, example: ['0', '1']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n PIM text, -- penalty minutes, example: ['59', '68']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_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:\nposition of goalie refers to pos = 'G'\nAmong the players who won an award in the year 1983, how many of them play the position of goalie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\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 GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepT text, -- September ties\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['R', 'Antti', 'Bruce']\n nameGiven text, -- example: ['Antti', 'Bruce']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n pos text, -- position, example: ['R', 'C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['R', 'C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n PIM text, -- Penalty minutes, example: ['336', '27']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PPG text, -- Power play goals, example: ['1', '5']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nregular season refers to `R/P` = 'R'\nHow many shoutouts are there in the regular season of 1977?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(year) FROM CombinedShutouts WHERE year = 1977 AND `R/P` = 'R'", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT COUNT(year) FROM CombinedShutouts WHERE year = 1977 AND `R/P` = 'R'", "index": 3608, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\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 GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepT text, -- September ties\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['R', 'Antti', 'Bruce']\n nameGiven text, -- example: ['Antti', 'Bruce']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n pos text, -- position, example: ['R', 'C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['R', 'C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n PIM text, -- Penalty minutes, example: ['336', '27']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PPG text, -- Power play goals, example: ['1', '5']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nregular season refers to `R/P` = 'R'\nHow many shoutouts are there in the regular season of 1977?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n NovW text, -- November wins, example: ['5', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n FebL integer, -- February loses, example: [3, 5]\n MarT text, -- March ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostT text, -- Postseason ties, example: ['1', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\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 Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n GA integer, -- Goals against, example: [104, 83]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteams scored against their opponent who had pulled their goalie refers to ENG is not null\nHow many teams scored against their opponent who had pulled their goalie in the year 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(tmID) FROM Goalies WHERE year = 2005 AND ENG IS NULL", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT COUNT(tmID) FROM Goalies WHERE year = 2005 AND ENG IS NULL", "index": 3609, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n NovW text, -- November wins, example: ['5', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n FebL integer, -- February loses, example: [3, 5]\n MarT text, -- March ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostT text, -- Postseason ties, example: ['1', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\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 Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n GA integer, -- Goals against, example: [104, 83]\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteams scored against their opponent who had pulled their goalie refers to ENG is not null\nHow many teams scored against their opponent who had pulled their goalie in the year 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 AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PKG text, -- Power play goals against, example: ['45', '43']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\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 GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHL', 'NHA']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n birthMon text, -- birth Month, example: ['3', '8']\n deathYear text, -- example: ['1964', '2000']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['NHL', 'PCHA', 'WCHL']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHL', 'NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPG text, -- Power play goals, example: ['0', '2']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n OctL text, -- October loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n JanOL text, -- January overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_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:\nshots recorded while the goalie was on the ice refers to SA IS NOT NULL; NHL League refers to lgID = 'NHL'\nPlease list the years in which the NHL League had shots recorded while the goalie was on the ice.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 year FROM Goalies WHERE lgID = 'NHL' AND SA IS NOT NULL", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT DISTINCT year FROM Goalies WHERE lgID = 'NHL' AND SA IS NOT NULL", "index": 3610, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PKG text, -- Power play goals against, example: ['45', '43']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\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 GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHL', 'NHA']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n birthMon text, -- birth Month, example: ['3', '8']\n deathYear text, -- example: ['1964', '2000']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['NHL', 'PCHA', 'WCHL']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHL', 'NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPG text, -- Power play goals, example: ['0', '2']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n OctL text, -- October loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n JanOL text, -- January overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_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:\nshots recorded while the goalie was on the ice refers to SA IS NOT NULL; NHL League refers to lgID = 'NHL'\nPlease list the years in which the NHL League had shots recorded while the goalie was on the ice.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n GWG text, -- Game-winning goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Builder', 'Player']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE CombinedShutouts (\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_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:\nHow many people were in the Hall of Fame's Builder category?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(hofID) FROM HOF WHERE category = 'Builder'", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT COUNT(hofID) FROM HOF WHERE category = 'Builder'", "index": 3611, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n GWG text, -- Game-winning goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Builder', 'Player']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE CombinedShutouts (\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_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:\nHow many people were in the Hall of Fame's Builder category?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n PPA text, -- Power play assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepL text, -- September loses, example: ['1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPG text, -- Power play goals, example: ['28', '51']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nafter the year 1980 refers to year>1980\nAmong the people who got into the Hall of Fame after the year 1980, how many of them belong to the category of \"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 COUNT(hofID) FROM HOF WHERE year > 1980 AND category = 'Player'", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT COUNT(hofID) FROM HOF WHERE year > 1980 AND category = 'Player'", "index": 3612, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n PPA text, -- Power play assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepL text, -- September loses, example: ['1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPG text, -- Power play goals, example: ['28', '51']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nafter the year 1980 refers to year>1980\nAmong the people who got into the Hall of Fame after the year 1980, how many of them belong to the category of \"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 GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n OctL text, -- October loses, example: ['1', '0']\n JanL integer, -- January loses, example: [1, 3]\n FebT integer, -- February ties, example: [0, 1]\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n AprT text, -- April ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PPG text, -- Power play goals, example: ['1', '5']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['Hall', 'Aalto', 'Abbey']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthCountry text, -- example: ['Finland', 'Canada']\n deathYear text, -- example: ['1964', '2000']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PPG text, -- Power play goals, example: ['28', '51']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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:\ntallest player refers to max(height)\nDid the tallest player got in the Hall of Fame? If yes, please list the year when he got in the Hall of Fame.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CASE WHEN T1.hofID IS NULL THEN 'NO' ELSE T2.year END FROM Master AS T1 LEFT JOIN HOF AS T2 ON T1.hofID = T2.hofID WHERE T1.height = ( SELECT MAX(height) FROM Master )", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT CASE WHEN T1.hofID IS NULL THEN 'NO' ELSE T2.year END FROM Master AS T1 LEFT JOIN HOF AS T2 ON T1.hofID = T2.hofID WHERE T1.height = ( SELECT MAX(height) FROM Master )", "index": 3613, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n OctL text, -- October loses, example: ['1', '0']\n JanL integer, -- January loses, example: [1, 3]\n FebT integer, -- February ties, example: [0, 1]\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n AprT text, -- April ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PPG text, -- Power play goals, example: ['1', '5']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['Hall', 'Aalto', 'Abbey']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthCountry text, -- example: ['Finland', 'Canada']\n deathYear text, -- example: ['1964', '2000']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PPG text, -- Power play goals, example: ['28', '51']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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:\ntallest player refers to max(height)\nDid the tallest player got in the Hall of Fame? If yes, please list the year when he got in the Hall of Fame.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PPA text, -- Power play assists, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostG text, -- Postseason goals, example: ['0', '2']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n shootCatch text, -- example: ['L', 'R']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthCountry text, -- example: ['Canada', 'Finland']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PPG text, -- Power play goals, example: ['1', '5']\n PKG text, -- Power play goals against, example: ['3', '8']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\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 ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebT integer, -- February ties, example: [0, 1]\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostW text, -- Postseason wins, example: ['0', '6']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_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:\nborn in Canada refers to birthCountry = 'Canada'\nPlease list the awards the coaches who are born in Canada have won.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.award FROM Master AS T1 INNER JOIN AwardsCoaches AS T2 ON T1.coachID = T2.coachID WHERE T1.birthCountry = 'Canada'", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT DISTINCT T2.award FROM Master AS T1 INNER JOIN AwardsCoaches AS T2 ON T1.coachID = T2.coachID WHERE T1.birthCountry = 'Canada'", "index": 3614, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PPA text, -- Power play assists, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostG text, -- Postseason goals, example: ['0', '2']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n shootCatch text, -- example: ['L', 'R']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthCountry text, -- example: ['Canada', 'Finland']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PPG text, -- Power play goals, example: ['1', '5']\n PKG text, -- Power play goals against, example: ['3', '8']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\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 ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebT integer, -- February ties, example: [0, 1]\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostW text, -- Postseason wins, example: ['0', '6']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_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:\nborn in Canada refers to birthCountry = 'Canada'\nPlease list the awards the coaches who are born in Canada have won.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n weight text, -- example: ['210', '185']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Canada', 'Finland']\n birthState text, -- example: ['ON', 'MB']\n deathMon text, -- death month, example: ['8', '2']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['NHL', 'PCHA', 'WCHL']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebT integer, -- February ties, example: [0, 1]\n MarT text, -- March ties, example: ['0', '1']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHL', 'NHA']\n GP integer, -- Games played, example: [3, 5]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['NHL', 'PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\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 GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SA text, -- Shots against, example: ['504', '1221']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_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:\nfrom Canada refers to birthCountry = 'Canada'; NHL league refers to lgID = 'NHL'\nAmong the coaches who have taught teams from the NHL League, how many of them are from Canada?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.coachID) FROM Master AS T1 INNER JOIN Coaches AS T2 ON T1.coachID = T2.coachID WHERE T2.lgID = 'NHL' AND T1.birthCountry = 'Canada'", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT COUNT(T2.coachID) FROM Master AS T1 INNER JOIN Coaches AS T2 ON T1.coachID = T2.coachID WHERE T2.lgID = 'NHL' AND T1.birthCountry = 'Canada'", "index": 3615, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n weight text, -- example: ['210', '185']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Canada', 'Finland']\n birthState text, -- example: ['ON', 'MB']\n deathMon text, -- death month, example: ['8', '2']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['NHL', 'PCHA', 'WCHL']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebT integer, -- February ties, example: [0, 1]\n MarT text, -- March ties, example: ['0', '1']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHL', 'NHA']\n GP integer, -- Games played, example: [3, 5]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['NHL', 'PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\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 GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SA text, -- Shots against, example: ['504', '1221']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_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:\nfrom Canada refers to birthCountry = 'Canada'; NHL league refers to lgID = 'NHL'\nAmong the coaches who have taught teams from the NHL League, how many of them are from Canada?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n OctL text, -- October loses, example: ['1', '0']\n NovT text, -- November ties, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n MarW text, -- March wins, example: ['1', '3']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthCity text, -- example: ['Toronto', 'Lappeenranta']\n deathMon text, -- death month, example: ['8', '2']\n deathCity text, -- example: ['Toronto', 'Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_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:\nborn in Toronto refers to birthCountry = 'Toronto'\nAmong the coaches who have received an award in 1940, how many of them are born in Toronto?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.coachID) FROM Master AS T1 INNER JOIN AwardsCoaches AS T2 ON T1.coachID = T2.coachID WHERE T2.year = 1940 AND T1.birthCity = 'Toronto'", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT COUNT(T1.coachID) FROM Master AS T1 INNER JOIN AwardsCoaches AS T2 ON T1.coachID = T2.coachID WHERE T2.year = 1940 AND T1.birthCity = 'Toronto'", "index": 3616, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n OctL text, -- October loses, example: ['1', '0']\n NovT text, -- November ties, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n MarW text, -- March wins, example: ['1', '3']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthCity text, -- example: ['Toronto', 'Lappeenranta']\n deathMon text, -- death month, example: ['8', '2']\n deathCity text, -- example: ['Toronto', 'Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_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:\nborn in Toronto refers to birthCountry = 'Toronto'\nAmong the coaches who have received an award in 1940, how many of them are born in Toronto?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\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 AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHL', 'NHA']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecL text, -- December loses, example: ['1', '0']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n nameGiven text, -- example: ['Antti', 'Bruce']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['NHL', 'PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_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:\nhave already died refers to deathYear IS NOT NULL; NHL league refers to lgID = 'NHL'\nPlease list the awards won by coaches who taught the NHL League and have already died.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.award FROM Master AS T1 INNER JOIN AwardsCoaches AS T2 ON T1.coachID = T2.coachID WHERE T1.deathYear IS NOT NULL AND T2.lgID = 'NHL'", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT DISTINCT T2.award FROM Master AS T1 INNER JOIN AwardsCoaches AS T2 ON T1.coachID = T2.coachID WHERE T1.deathYear IS NOT NULL AND T2.lgID = 'NHL'", "index": 3617, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\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 AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHL', 'NHA']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecL text, -- December loses, example: ['1', '0']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n nameGiven text, -- example: ['Antti', 'Bruce']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['NHL', 'PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_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:\nhave already died refers to deathYear IS NOT NULL; NHL league refers to lgID = 'NHL'\nPlease list the awards won by coaches who taught the NHL League and have already died.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n FebW integer, -- February wins, example: [2, 1]\n FebT integer, -- February ties, example: [0, 1]\n MarT text, -- March ties, example: ['0', '1']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_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:\nPlease list the birth cities of the players who have won an award in the year 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.birthCity FROM Master AS T1 INNER JOIN AwardsPlayers AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 1970", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT DISTINCT T1.birthCity FROM Master AS T1 INNER JOIN AwardsPlayers AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 1970", "index": 3618, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n FebW integer, -- February wins, example: [2, 1]\n FebT integer, -- February ties, example: [0, 1]\n MarT text, -- March ties, example: ['0', '1']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_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:\nPlease list the birth cities of the players who have won an award in the year 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 Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPG text, -- Power play goals, example: ['28', '51']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postt text, -- post-season ties, example: ['0', '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 abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `month` integer, -- example: [3, 2]\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n NovW text, -- November wins, example: ['5', '1']\n NovT text, -- November ties, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n MarW text, -- March wins, example: ['1', '3']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n SOG text, -- Shots on goal, example: ['1', '61']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n weight text, -- example: ['210', '185']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n birthYear text, -- example: ['1975', '1951']\n birthCountry text, -- example: ['Finland', 'Canada']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PKG text, -- Power play goals against, example: ['3', '8']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) 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:\ndied in Massachussets refers to deathState = 'Massachussets'\nAmong the players who died in Massachussets, how many of them have won an 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 COUNT(DISTINCT T1.playerID) FROM Master AS T1 INNER JOIN AwardsPlayers AS T2 ON T1.playerID = T2.playerID WHERE T1.deathState = 'MA'", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T1.playerID) FROM Master AS T1 INNER JOIN AwardsPlayers AS T2 ON T1.playerID = T2.playerID WHERE T1.deathState = 'MA'", "index": 3619, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPG text, -- Power play goals, example: ['28', '51']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postt text, -- post-season ties, example: ['0', '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 abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `month` integer, -- example: [3, 2]\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n NovW text, -- November wins, example: ['5', '1']\n NovT text, -- November ties, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n MarW text, -- March wins, example: ['1', '3']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n SOG text, -- Shots on goal, example: ['1', '61']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n weight text, -- example: ['210', '185']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n birthYear text, -- example: ['1975', '1951']\n birthCountry text, -- example: ['Finland', 'Canada']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PKG text, -- Power play goals against, example: ['3', '8']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) 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:\ndied in Massachussets refers to deathState = 'Massachussets'\nAmong the players who died in Massachussets, how many of them have won an 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 ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['March', 'Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n shootCatch text, -- example: ['L', 'R']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['All-Rookie', 'First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PPG text, -- Power play goals, example: ['1', '5']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in March refers to birthMon = '3'; nicknames refers to nameNick\nPlease list the nicknames of the players who have won the All-Rookie award and are born in March.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.nameNick FROM Master AS T1 INNER JOIN AwardsPlayers AS T2 ON T1.playerID = T2.playerID WHERE T2.award = 'All-Rookie' AND T1.birthMon = 3", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT DISTINCT T1.nameNick FROM Master AS T1 INNER JOIN AwardsPlayers AS T2 ON T1.playerID = T2.playerID WHERE T2.award = 'All-Rookie' AND T1.birthMon = 3", "index": 3620, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['March', 'Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n shootCatch text, -- example: ['L', 'R']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['All-Rookie', 'First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PPG text, -- Power play goals, example: ['1', '5']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in March refers to birthMon = '3'; nicknames refers to nameNick\nPlease list the nicknames of the players who have won the All-Rookie award and are born in March.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPG text, -- Power play goals, example: ['28', '51']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameNick text, -- Nickname, example: ['Count', 'Max', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n deathMon text, -- death month, example: ['8', '2']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPA text, -- Power play assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_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:\nwho has won the most awards refers to max(count(award)); the month player was born refers to birthMon\nIn which month was the player who has won the most awards born?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.birthMon FROM Master AS T1 INNER JOIN AwardsPlayers AS T2 ON T1.playerID = T2.playerID GROUP BY T2.playerID ORDER BY COUNT(T2.award) DESC LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T1.birthMon FROM Master AS T1 INNER JOIN AwardsPlayers AS T2 ON T1.playerID = T2.playerID GROUP BY T2.playerID ORDER BY COUNT(T2.award) DESC LIMIT 1", "index": 3621, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPG text, -- Power play goals, example: ['28', '51']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameNick text, -- Nickname, example: ['Count', 'Max', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n deathMon text, -- death month, example: ['8', '2']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPA text, -- Power play assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_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:\nwho has won the most awards refers to max(count(award)); the month player was born refers to birthMon\nIn which month was the player who has won the most awards born?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PPC text, -- Power play chances, example: ['39', '27']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovT text, -- November ties, example: ['0', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoW text, -- Shootout wins, example: ['3', '5']\n GA integer, -- Goals against, example: [104, 83]\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Max', 'Antti', 'Bruce']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthYear text, -- example: ['1975', '1951']\n birthCountry text, -- example: ['Finland', 'Canada']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_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:\nreceived the most awards in total refers to max(count(award))\nPlayers born in which year have received the most awards in total?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.birthYear FROM Master AS T1 INNER JOIN AwardsPlayers AS T2 ON T1.playerID = T2.playerID GROUP BY T1.birthYear ORDER BY COUNT(T2.award) DESC LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T1.birthYear FROM Master AS T1 INNER JOIN AwardsPlayers AS T2 ON T1.playerID = T2.playerID GROUP BY T1.birthYear ORDER BY COUNT(T2.award) DESC LIMIT 1", "index": 3622, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PPC text, -- Power play chances, example: ['39', '27']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovT text, -- November ties, example: ['0', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoW text, -- Shootout wins, example: ['3', '5']\n GA integer, -- Goals against, example: [104, 83]\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Max', 'Antti', 'Bruce']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthYear text, -- example: ['1975', '1951']\n birthCountry text, -- example: ['Finland', 'Canada']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_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:\nreceived the most awards in total refers to max(count(award))\nPlayers born in which year have received the most awards in total?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n pos text, -- position, example: ['C', 'D']\n birthCountry text, -- example: ['Finland', 'Canada']\n deathMon text, -- death month, example: ['8', '2']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['WIN', 'CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\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 TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['WIN', 'ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n PostA text, -- Postseason assists, example: ['0', '1']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['WIN', 'VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['WIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['WIN', 'BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n rT integer, -- Road ties, example: [0, 1]\n SepL text, -- September loses, example: ['1']\n OctW text, -- October wins, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE CombinedShutouts (\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\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:\nmost award-winning refers to max(count(award)); country player is from refers to birthCountry\nWhich country is the most award-winning player from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.birthCountry FROM Master AS T1 INNER JOIN AwardsPlayers AS T2 ON T1.playerID = T2.playerID GROUP BY T1.birthCountry ORDER BY COUNT(T2.award) DESC LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T1.birthCountry FROM Master AS T1 INNER JOIN AwardsPlayers AS T2 ON T1.playerID = T2.playerID GROUP BY T1.birthCountry ORDER BY COUNT(T2.award) DESC LIMIT 1", "index": 3623, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n pos text, -- position, example: ['C', 'D']\n birthCountry text, -- example: ['Finland', 'Canada']\n deathMon text, -- death month, example: ['8', '2']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['WIN', 'CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\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 TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['WIN', 'ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n PostA text, -- Postseason assists, example: ['0', '1']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['WIN', 'VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['WIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['WIN', 'BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n rT integer, -- Road ties, example: [0, 1]\n SepL text, -- September loses, example: ['1']\n OctW text, -- October wins, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE CombinedShutouts (\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\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:\nmost award-winning refers to max(count(award)); country player is from refers to birthCountry\nWhich country is the most award-winning player from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n PPG text, -- Power play goals, example: ['28', '51']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PPC text, -- Power play chances, example: ['39', '27']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n OctL text, -- October loses, example: ['1', '0']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n FebL integer, -- February loses, example: [3, 5]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\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 Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PostA text, -- Postseason assists, example: ['0', '1']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['Hall', 'Aalto', 'Abbey']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n deathDay text, -- example: ['1', '7']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) 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:\ncountry refers to birthCountry\nWhich country has the most players in the Hall of Fame?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.birthCountry FROM Master AS T1 INNER JOIN HOF AS T2 ON T1.hofID = T2.hofID GROUP BY T1.birthCountry ORDER BY COUNT(T1.playerID) DESC LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T1.birthCountry FROM Master AS T1 INNER JOIN HOF AS T2 ON T1.hofID = T2.hofID GROUP BY T1.birthCountry ORDER BY COUNT(T1.playerID) DESC LIMIT 1", "index": 3624, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n PPG text, -- Power play goals, example: ['28', '51']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PPC text, -- Power play chances, example: ['39', '27']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n OctL text, -- October loses, example: ['1', '0']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n FebL integer, -- February loses, example: [3, 5]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\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 Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PostA text, -- Postseason assists, example: ['0', '1']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['Hall', 'Aalto', 'Abbey']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n deathDay text, -- example: ['1', '7']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) 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:\ncountry refers to birthCountry\nWhich country has the most players in the Hall of Fame?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['F', 'W', 'C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPA text, -- Power play assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n MarW text, -- March wins, example: ['1', '3']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['F', 'CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['All-Rookie', 'First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['RW', 'LW', 'F', 'W', 'C']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PKG text, -- Power play goals against, example: ['45', '43']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['F', 'W', 'C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Canada', 'Finland']\n birthState text, -- example: ['ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['Canada', 'USA']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['F', 'D', 'R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_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:\nborn in Canada refers to birthCountry = 'Canada'; pos = 'LW' refers to left winger; pos = 'RW' refers to right winger; pos = 'C' refers to center; pos = 'G' refers to goalie; pos = 'D' refers to defenceman; pos = 'W' refers to winger; pos = 'F' refers to forward\nPlease list the positions of the players who were born in Canada and have won the All-Rookie 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 DISTINCT T1.pos FROM Master AS T1 INNER JOIN AwardsPlayers AS T2 ON T1.playerID = T2.playerID WHERE T1.birthCountry = 'Canada' AND T2.award = 'All-Rookie'", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT DISTINCT T1.pos FROM Master AS T1 INNER JOIN AwardsPlayers AS T2 ON T1.playerID = T2.playerID WHERE T1.birthCountry = 'Canada' AND T2.award = 'All-Rookie'", "index": 3625, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['F', 'W', 'C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPA text, -- Power play assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n MarW text, -- March wins, example: ['1', '3']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['F', 'CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['All-Rookie', 'First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['RW', 'LW', 'F', 'W', 'C']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PKG text, -- Power play goals against, example: ['45', '43']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['F', 'W', 'C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Canada', 'Finland']\n birthState text, -- example: ['ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['Canada', 'USA']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['F', 'D', 'R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_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:\nborn in Canada refers to birthCountry = 'Canada'; pos = 'LW' refers to left winger; pos = 'RW' refers to right winger; pos = 'C' refers to center; pos = 'G' refers to goalie; pos = 'D' refers to defenceman; pos = 'W' refers to winger; pos = 'F' refers to forward\nPlease list the positions of the players who were born in Canada and have won the All-Rookie 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 TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n OctL text, -- October loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostT text, -- Postseason ties, example: ['1', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postl text, -- post-season loses, example: ['4', '5']\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 GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPA text, -- Power play assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Count', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage BMI = divide(sum(divide(weight, multiply(height, height))), count(coachID))\nWhat is the average BMI of all the coaches who have gotten in the Hall of Fame?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.weight / (T1.height * T1.height)) / COUNT(T1.coachID) FROM Master AS T1 INNER JOIN HOF AS T2 ON T1.hofID = T2.hofID", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT SUM(T1.weight / (T1.height * T1.height)) / COUNT(T1.coachID) FROM Master AS T1 INNER JOIN HOF AS T2 ON T1.hofID = T2.hofID", "index": 3626, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n OctL text, -- October loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostT text, -- Postseason ties, example: ['1', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postl text, -- post-season loses, example: ['4', '5']\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 GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPA text, -- Power play assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Count', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage BMI = divide(sum(divide(weight, multiply(height, height))), count(coachID))\nWhat is the average BMI of all the coaches who have gotten in the Hall of Fame?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n rW integer, -- Road wins, example: [2, 1]\n SepL text, -- September loses, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n NovW text, -- November wins, example: ['5', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebOL text, -- February overtime loses, example: ['0', '1']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['rutlewa01', 'aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPA text, -- Power play assists, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['rutlewa01', 'aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n weight text, -- example: ['210', '185']\n pos text, -- position, example: ['C', 'D']\n birthCountry text, -- example: ['Finland', 'Canada']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postl text, -- post-season loses, example: ['4', '5']\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 AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['rutlewa01', 'abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal number of the games refers to GP\nWhat was the total number of the games that player Id \"rutlewa01\" played in 1967?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT GP FROM Goalies WHERE playerID = 'rutlewa01' AND year = 1967", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT GP FROM Goalies WHERE playerID = 'rutlewa01' AND year = 1967", "index": 3627, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n rW integer, -- Road wins, example: [2, 1]\n SepL text, -- September loses, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n NovW text, -- November wins, example: ['5', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebOL text, -- February overtime loses, example: ['0', '1']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['rutlewa01', 'aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPA text, -- Power play assists, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['rutlewa01', 'aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n weight text, -- example: ['210', '185']\n pos text, -- position, example: ['C', 'D']\n birthCountry text, -- example: ['Finland', 'Canada']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postl text, -- post-season loses, example: ['4', '5']\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 AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['rutlewa01', 'abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal number of the games refers to GP\nWhat was the total number of the games that player Id \"rutlewa01\" played in 1967?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['WIN', 'TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['Second Team All-Star', 'First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepT text, -- September ties\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n AprT text, -- April ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['Second Team All-Star', 'First Team All-Star']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['WIN', 'BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthMon text, -- birth Month, example: ['3', '8']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['WIN', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPA text, -- Power play assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['WIN', 'CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['WIN', 'VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['WIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_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 number of wins refers to count(w)\nFor the coach who won Second Team All-Star in 1933, how many wins did he 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 SUM(T1.W) FROM Coaches AS T1 INNER JOIN AwardsCoaches AS T2 ON T1.coachID = T2.coachID WHERE T2.year = 1933 AND T2.award = 'Second Team All-Star'", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT SUM(T1.W) FROM Coaches AS T1 INNER JOIN AwardsCoaches AS T2 ON T1.coachID = T2.coachID WHERE T2.year = 1933 AND T2.award = 'Second Team All-Star'", "index": 3628, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['WIN', 'TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['Second Team All-Star', 'First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepT text, -- September ties\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n AprT text, -- April ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['Second Team All-Star', 'First Team All-Star']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['WIN', 'BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthMon text, -- birth Month, example: ['3', '8']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['WIN', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPA text, -- Power play assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['WIN', 'CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['WIN', 'VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['WIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_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 number of wins refers to count(w)\nFor the coach who won Second Team All-Star in 1933, how many wins did he 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 TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PPG text, -- Power play goals, example: ['0', '2']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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 ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['P194502', '14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['HI', 'MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_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:\nnote = 'posthumous'refers to \"didn't personally attend\"\nDid legendsID \"P194502\" personally attend his Hall of Fame dedication?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT IIF(T1.note = 'posthumous', 'YES', 'NO') FROM AwardsMisc AS T1 RIGHT JOIN Master AS T2 ON T1.ID = T2.playerID WHERE T2.legendsID = 'P194502'", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT IIF(T1.note = 'posthumous', 'YES', 'NO') FROM AwardsMisc AS T1 RIGHT JOIN Master AS T2 ON T1.ID = T2.playerID WHERE T2.legendsID = 'P194502'", "index": 3629, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PPG text, -- Power play goals, example: ['0', '2']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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 ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['P194502', '14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['HI', 'MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_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:\nnote = 'posthumous'refers to \"didn't personally attend\"\nDid legendsID \"P194502\" personally attend his Hall of Fame dedication?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PKG text, -- Power play goals against, example: ['3', '8']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['F', 'CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Mike', 'Antti', 'Bruce']\n lastName text, -- example: ['Antonovich', 'Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Mike', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n pos text, -- position, example: ['F', 'W', 'D', 'C']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['F', 'D', 'R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['F', 'D', 'A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['RW', 'LW', 'F', 'W', 'C']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['F', 'W', 'D', 'C']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_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:\npos = 'LW' refers to left winger; pos = 'RW' refers to right winger; pos = 'C' refers to center; pos = 'G' refers to goalie; pos = 'D' refers to defenceman; pos = 'W' refers to winger; pos = 'F' refers to forward\nWhich position did Mike Antonovich play?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.pos FROM Master AS T1 INNER JOIN AwardsPlayers AS T2 ON T1.playerID = T2.playerID WHERE T1.firstName = 'Mike' AND T1.lastName = 'Antonovich'", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T1.pos FROM Master AS T1 INNER JOIN AwardsPlayers AS T2 ON T1.playerID = T2.playerID WHERE T1.firstName = 'Mike' AND T1.lastName = 'Antonovich'", "index": 3630, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PKG text, -- Power play goals against, example: ['3', '8']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['F', 'CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Mike', 'Antti', 'Bruce']\n lastName text, -- example: ['Antonovich', 'Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Mike', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n pos text, -- position, example: ['F', 'W', 'D', 'C']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['F', 'D', 'R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['F', 'D', 'A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['RW', 'LW', 'F', 'W', 'C']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['F', 'W', 'D', 'C']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_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:\npos = 'LW' refers to left winger; pos = 'RW' refers to right winger; pos = 'C' refers to center; pos = 'G' refers to goalie; pos = 'D' refers to defenceman; pos = 'W' refers to winger; pos = 'F' refers to forward\nWhich position did Mike Antonovich play?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PKG text, -- Power play goals against, example: ['3', '8']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n lastName text, -- example: ['Weight', 'Aalto', 'Abbey']\n nameNick text, -- Nickname, example: ['Max', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthYear text, -- example: ['1975', '1951']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovT text, -- November ties, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n JanT integer, -- January ties, example: [0, 1]\n FebL integer, -- February loses, example: [3, 5]\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\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 ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_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 third goalie refers to stint = 3; the biggest weight refers to max(weight)\nWhich player who showed as the third goalie in a game has the biggest weight? 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.lastName FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T2.stint = 3 ORDER BY T1.weight DESC LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T1.firstName, T1.lastName FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T2.stint = 3 ORDER BY T1.weight DESC LIMIT 1", "index": 3631, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PKG text, -- Power play goals against, example: ['3', '8']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n lastName text, -- example: ['Weight', 'Aalto', 'Abbey']\n nameNick text, -- Nickname, example: ['Max', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthYear text, -- example: ['1975', '1951']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovT text, -- November ties, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n JanT integer, -- January ties, example: [0, 1]\n FebL integer, -- February loses, example: [3, 5]\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\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 ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_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 third goalie refers to stint = 3; the biggest weight refers to max(weight)\nWhich player who showed as the third goalie in a game has the biggest weight? 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 Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n height text, -- example: ['73', '67']\n legendsID text, -- example: ['14862', '18411']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PKG text, -- Power play goals against, example: ['3', '8']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n DecL text, -- December loses, example: ['1', '0']\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `month` integer, -- example: [3, 2]\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\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 ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n10 empty net goals refers to ENG = 10; the tallest refers to max(height)\nAmong the players who had 10 empty net goals in their career, who is the tallest? Show his full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.firstName, T1.lastName FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID GROUP BY T2.playerID, T1.height HAVING SUM(T2.ENG) > 10 ORDER BY T1.height DESC LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T1.firstName, T1.lastName FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID GROUP BY T2.playerID, T1.height HAVING SUM(T2.ENG) > 10 ORDER BY T1.height DESC LIMIT 1", "index": 3632, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n height text, -- example: ['73', '67']\n legendsID text, -- example: ['14862', '18411']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PKG text, -- Power play goals against, example: ['3', '8']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n DecL text, -- December loses, example: ['1', '0']\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `month` integer, -- example: [3, 2]\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\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 ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n10 empty net goals refers to ENG = 10; the tallest refers to max(height)\nAmong the players who had 10 empty net goals in their career, who is the tallest? Show his full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPC text, -- Power play chances, example: ['220', '279']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE CombinedShutouts (\n tmID text, -- team ID, example: ['NJD', 'TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['NJD', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['NJD', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['NJD', 'CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postl text, -- post-season loses, example: ['4', '5']\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 AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['NJD', 'BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['NJD', 'ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PKG text, -- Power play goals against, example: ['3', '8']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n birthYear text, -- example: ['1975', '1951']\n deathYear text, -- example: ['1964', '2000']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['NJD', 'VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['NJD', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['NJD', 'COB', 'HAI']\n rT integer, -- Road ties, example: [0, 1]\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_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:\nsaved the most goal attempts refers to max(subtract(SA, GA)); team id refers to tmID\nIn the history of team id NJD, which goalie saved the most goal attempts? Give his full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.firstName, T1.lastName FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T2.tmID = 'NJD' GROUP BY T2.playerID ORDER BY SUM(T2.SA - T2.GA) DESC LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T1.firstName, T1.lastName FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T2.tmID = 'NJD' GROUP BY T2.playerID ORDER BY SUM(T2.SA - T2.GA) DESC LIMIT 1", "index": 3633, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPC text, -- Power play chances, example: ['220', '279']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE CombinedShutouts (\n tmID text, -- team ID, example: ['NJD', 'TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['NJD', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['NJD', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['NJD', 'CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postl text, -- post-season loses, example: ['4', '5']\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 AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['NJD', 'BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['NJD', 'ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PKG text, -- Power play goals against, example: ['3', '8']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n birthYear text, -- example: ['1975', '1951']\n deathYear text, -- example: ['1964', '2000']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['NJD', 'VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['NJD', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['NJD', 'COB', 'HAI']\n rT integer, -- Road ties, example: [0, 1]\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_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:\nsaved the most goal attempts refers to max(subtract(SA, GA)); team id refers to tmID\nIn the history of team id NJD, which goalie saved the most goal attempts? Give his full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctL text, -- October loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanL integer, -- January loses, example: [1, 3]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebL integer, -- February loses, example: [3, 5]\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\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: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n nameNick text, -- Nickname, example: ['Max', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthDay text, -- example: ['4', '18']\n birthCity text, -- example: ['Most', 'Lappeenranta', 'Toronto']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['PT', 'CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PPG text, -- Power play goals, example: ['1', '5']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npoints refer to Pts; the most postseason shutouts refers to max(PostSHO)\nFor the team which had the most postseason shutouts in 1995, how many points did they 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 SUM(T2.SHO) FROM Scoring AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 1995 GROUP BY T2.tmID ORDER BY SUM(T2.PostSHO) DESC LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT SUM(T2.SHO) FROM Scoring AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 1995 GROUP BY T2.tmID ORDER BY SUM(T2.PostSHO) DESC LIMIT 1", "index": 3634, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctL text, -- October loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanL integer, -- January loses, example: [1, 3]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebL integer, -- February loses, example: [3, 5]\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\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: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n nameNick text, -- Nickname, example: ['Max', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthDay text, -- example: ['4', '18']\n birthCity text, -- example: ['Most', 'Lappeenranta', 'Toronto']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['PT', 'CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PPG text, -- Power play goals, example: ['1', '5']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npoints refer to Pts; the most postseason shutouts refers to max(PostSHO)\nFor the team which had the most postseason shutouts in 1995, how many points did they 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 AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovT text, -- November ties, example: ['0', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebL integer, -- February loses, example: [3, 5]\n MarL text, -- March loses, example: ['4', '0']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['broadpu01', 'adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['broadpu01', 'aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n lastName text, -- example: ['Stanley', 'Aalto', 'Abbey']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Stanley Cup Finals', 'Finals', 'Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n PPG text, -- Power play goals, example: ['28', '51']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['broadpu01', 'abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['broadpu01', 'aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n SHG text, -- Shorthanded goals, example: ['0', '2']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\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 ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe number of games refers to GP\nIn the Stanley Cup finals history, how many games did player id \"broadpu01\" play in 1922?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT GP FROM ScoringSC WHERE playerID = 'broadpu01' AND YEAR = 1922", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT GP FROM ScoringSC WHERE playerID = 'broadpu01' AND YEAR = 1922", "index": 3635, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovT text, -- November ties, example: ['0', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebL integer, -- February loses, example: [3, 5]\n MarL text, -- March loses, example: ['4', '0']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['broadpu01', 'adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['broadpu01', 'aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n lastName text, -- example: ['Stanley', 'Aalto', 'Abbey']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Stanley Cup Finals', 'Finals', 'Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n PPG text, -- Power play goals, example: ['28', '51']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['broadpu01', 'abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['broadpu01', 'aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n SHG text, -- Shorthanded goals, example: ['0', '2']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\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 ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe number of games refers to GP\nIn the Stanley Cup finals history, how many games did player id \"broadpu01\" play in 1922?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['WIN', 'VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['WIN', 'QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['WIN', 'CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovT text, -- November ties, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n FebL integer, -- February loses, example: [3, 5]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['WIN', 'BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['W', 'C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['WIN', 'ANA', 'CIN']\n pos text, -- position, example: ['W', 'C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPG text, -- Power play goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostA text, -- Postseason assists, example: ['0', '1']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['WIN', 'TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameNick text, -- Nickname, example: ['Count', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['W', 'C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_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:\nthree different goalies refer to count(playerID) = 3; game won refers to W\nFor the team which had three different goalies in the 2011 postseason games, how many games did they win in the regular 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 SUM(T2.W) FROM Goalies AS T1 INNER JOIN Teams AS T2 ON T1.tmID = T2.tmID WHERE T2.year = 2011 GROUP BY T1.tmID HAVING COUNT(DISTINCT T1.playerID) = 3", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT SUM(T2.W) FROM Goalies AS T1 INNER JOIN Teams AS T2 ON T1.tmID = T2.tmID WHERE T2.year = 2011 GROUP BY T1.tmID HAVING COUNT(DISTINCT T1.playerID) = 3", "index": 3636, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['WIN', 'VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['WIN', 'QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['WIN', 'CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovT text, -- November ties, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n FebL integer, -- February loses, example: [3, 5]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['WIN', 'BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['W', 'C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['WIN', 'ANA', 'CIN']\n pos text, -- position, example: ['W', 'C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPG text, -- Power play goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostA text, -- Postseason assists, example: ['0', '1']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['WIN', 'TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameNick text, -- Nickname, example: ['Count', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['W', 'C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_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:\nthree different goalies refer to count(playerID) = 3; game won refers to W\nFor the team which had three different goalies in the 2011 postseason games, how many games did they win in the regular 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 TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n GA integer, -- Goals against, example: [104, 83]\n PIM text, -- Penalty minutes, example: ['336', '27']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepL text, -- September loses, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n JanW integer, -- January wins, example: [1, 0]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n MarW text, -- March wins, example: ['1', '3']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Max', 'Antti', 'Bruce']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthState text, -- example: ['ON', 'MB']\n deathMon text, -- death month, example: ['8', '2']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_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:\nthe most postseason shots Against refers to max(PostSA); year born refers to birthYear\nWhich year was the goalie who had the most postseaon shots Against in 2008 born?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.birthYear FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 2008 ORDER BY T2.PostSA DESC LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T1.birthYear FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 2008 ORDER BY T2.PostSA DESC LIMIT 1", "index": 3637, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n GA integer, -- Goals against, example: [104, 83]\n PIM text, -- Penalty minutes, example: ['336', '27']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepL text, -- September loses, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n JanW integer, -- January wins, example: [1, 0]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n MarW text, -- March wins, example: ['1', '3']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Max', 'Antti', 'Bruce']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthState text, -- example: ['ON', 'MB']\n deathMon text, -- death month, example: ['8', '2']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_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:\nthe most postseason shots Against refers to max(PostSA); year born refers to birthYear\nWhich year was the goalie who had the most postseaon shots Against in 2008 born?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Max', 'Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Max', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_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 Plus/minus refers to MAX(+/-); full name refers to firstName, lastName; 1981 season refers to year = '1981'\n\n\nFor he who had the highest plus / minus on the court in the 1981 season, what's his full name?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.firstName, T1.lastName FROM Master AS T1 INNER JOIN Scoring AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 1981 GROUP BY T2.playerID ORDER BY SUM(T2.`+/-`) DESC LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T1.firstName, T1.lastName FROM Master AS T1 INNER JOIN Scoring AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 1981 GROUP BY T2.playerID ORDER BY SUM(T2.`+/-`) DESC LIMIT 1", "index": 3638, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Max', 'Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Max', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_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 Plus/minus refers to MAX(+/-); full name refers to firstName, lastName; 1981 season refers to year = '1981'\n\n\nFor he who had the highest plus / minus on the court in the 1981 season, what's his full name?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PKG text, -- Power play goals against, example: ['3', '8']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Cam Neely', 'Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Cam', 'Antti', 'Bruce']\n lastName text, -- example: ['Neely', 'Aalto', 'Abbey']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n weight text, -- example: ['210', '185']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['Cam Neely', '1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_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:\n1990 refers to the year played; Shot on goal refers to SOG\n\nHow many shots on goal did Cam Neely had in the year of 1990?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.SOG FROM Master AS T1 INNER JOIN Scoring AS T2 ON T1.playerID = T2.playerID WHERE T1.firstName = 'Cam' AND T1.lastName = 'Neely' AND T2.year = '1990'", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T2.SOG FROM Master AS T1 INNER JOIN Scoring AS T2 ON T1.playerID = T2.playerID WHERE T1.firstName = 'Cam' AND T1.lastName = 'Neely' AND T2.year = '1990'", "index": 3639, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PKG text, -- Power play goals against, example: ['3', '8']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Cam Neely', 'Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Cam', 'Antti', 'Bruce']\n lastName text, -- example: ['Neely', 'Aalto', 'Abbey']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n weight text, -- example: ['210', '185']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['Cam Neely', '1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_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:\n1990 refers to the year played; Shot on goal refers to SOG\n\nHow many shots on goal did Cam Neely had in the year of 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 Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Alain', 'Antti', 'Bruce']\n lastName text, -- example: ['Vigneault', 'Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Vancouver', 'Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VAN', 'VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['VAN', 'QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['VAN', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Vancouver Canucks', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['VAN', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['VAN', 'TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['VAN', 'NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['VAN', 'BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['VAN', 'CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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 AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['VAN', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['VAN', 'WIN', 'COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarT text, -- March ties, example: ['0', '1']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwinning rate refers to DIVIDE (w, SUM(w, l)); Vancouver Canucks is name of team where tmID = 'VAN'\nWinning rate refers to DIVIDE(wins in year = '2005/2006'(ADD(wins+loses); improvement refers to SUBTRACT(DIVIDE(wins in year = '2005'(ADD(wins+loses), DIVIDE(wins in year = '2006'(ADD(wins+loses))\n\nWhat is the percentage of winning rate of improvement since Alain Vigneault became the coach of Vancouver Canucks in 2006 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 SUM(CASE WHEN T1.year = 2006 THEN CAST(T1.W AS REAL) * 100 / (T1.W + T1.L) ELSE 0 END) - ( SELECT CAST(W AS REAL) * 100 / (W + L) FROM Teams WHERE year = '2005' AND name = 'Vancouver Canucks' ) FROM Teams AS T1 INNER JOIN Coaches AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year INNER JOIN Master AS T3 ON T2.coachID = T3.coachID WHERE T1.name = 'Vancouver Canucks' AND T3.firstName = 'Alain' AND T3.lastName = 'Vigneault'", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT SUM(CASE WHEN T1.year = 2006 THEN CAST(T1.W AS REAL) * 100 / (T1.W + T1.L) ELSE 0 END) - ( SELECT CAST(W AS REAL) * 100 / (W + L) FROM Teams WHERE year = '2005' AND name = 'Vancouver Canucks' ) FROM Teams AS T1 INNER JOIN Coaches AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year INNER JOIN Master AS T3 ON T2.coachID = T3.coachID WHERE T1.name = 'Vancouver Canucks' AND T3.firstName = 'Alain' AND T3.lastName = 'Vigneault'", "index": 3640, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Alain', 'Antti', 'Bruce']\n lastName text, -- example: ['Vigneault', 'Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Vancouver', 'Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VAN', 'VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['VAN', 'QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['VAN', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Vancouver Canucks', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['VAN', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['VAN', 'TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['VAN', 'NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['VAN', 'BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['VAN', 'CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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 AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['VAN', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['VAN', 'WIN', 'COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarT text, -- March ties, example: ['0', '1']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwinning rate refers to DIVIDE (w, SUM(w, l)); Vancouver Canucks is name of team where tmID = 'VAN'\nWinning rate refers to DIVIDE(wins in year = '2005/2006'(ADD(wins+loses); improvement refers to SUBTRACT(DIVIDE(wins in year = '2005'(ADD(wins+loses), DIVIDE(wins in year = '2006'(ADD(wins+loses))\n\nWhat is the percentage of winning rate of improvement since Alain Vigneault became the coach of Vancouver Canucks in 2006 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 TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepL text, -- September loses, example: ['1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n MarL text, -- March loses, example: ['4', '0']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n PPG text, -- Power play goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n nameGiven text, -- example: ['Antti', 'Bruce']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n birthState text, -- example: ['ID', 'ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_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:\nPost season of 2011 refers to year = ’2011’\ndefensive success rate refers to (SUBTRACT(1 (DIVIDE(PostGA/PostSA)), *100%)\n\nFor the goalie who had the highest defensive success rate in the postseason of 2011, what's his legends ID ?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.legendsID FROM Goalies AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID WHERE T1.year = 2011 ORDER BY 1 - CAST(T1.PostGA AS REAL) / T1.PostSA DESC LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T2.legendsID FROM Goalies AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID WHERE T1.year = 2011 ORDER BY 1 - CAST(T1.PostGA AS REAL) / T1.PostSA DESC LIMIT 1", "index": 3641, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepL text, -- September loses, example: ['1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n MarL text, -- March loses, example: ['4', '0']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n PPG text, -- Power play goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n nameGiven text, -- example: ['Antti', 'Bruce']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n birthState text, -- example: ['ID', 'ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_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:\nPost season of 2011 refers to year = ’2011’\ndefensive success rate refers to (SUBTRACT(1 (DIVIDE(PostGA/PostSA)), *100%)\n\nFor the goalie who had the highest defensive success rate in the postseason of 2011, what's his legends ID ?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepT text, -- September ties\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanL integer, -- January loses, example: [1, 3]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n height text, -- example: ['73', '67']\n shootCatch text, -- example: ['L', 'R']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Most', 'Lappeenranta', 'Toronto']\n deathCountry text, -- example: ['USA', 'Canada']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_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:\npenalty refers to BenchMinor; Ties refer to T\nAmong the teams with the most number of ties, how many penalty was committed by a player or coach that is not on the ice? Indicate the 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 BenchMinor, name FROM Teams ORDER BY T DESC LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT BenchMinor, name FROM Teams ORDER BY T DESC LIMIT 1", "index": 3642, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepT text, -- September ties\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanL integer, -- January loses, example: [1, 3]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n height text, -- example: ['73', '67']\n shootCatch text, -- example: ['L', 'R']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Most', 'Lappeenranta', 'Toronto']\n deathCountry text, -- example: ['USA', 'Canada']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_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:\npenalty refers to BenchMinor; Ties refer to T\nAmong the teams with the most number of ties, how many penalty was committed by a player or coach that is not on the ice? Indicate the 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 SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Max', 'Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Max', 'Preacher', 'Taffy']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Most', 'Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n PPG text, -- Power play goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\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 AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n rT integer, -- Road ties, example: [0, 1]\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebT integer, -- February ties, example: [0, 1]\n MarL text, -- March loses, example: ['4', '0']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPC text, -- Power play chances, example: ['220', '279']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_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:\nYear most hockey players were born refers to MAX(birthYear); birthCountry refers to the country where a player was born\n\nWhich country produced the most number of hockey players? Identify which year was most of the hockey players are born.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 birthCountry, birthYear FROM Master GROUP BY birthCountry, birthYear ORDER BY COUNT(birthCountry) DESC LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT DISTINCT birthCountry, birthYear FROM Master GROUP BY birthCountry, birthYear ORDER BY COUNT(birthCountry) DESC LIMIT 1", "index": 3643, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Max', 'Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Max', 'Preacher', 'Taffy']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Most', 'Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n PPG text, -- Power play goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\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 AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n rT integer, -- Road ties, example: [0, 1]\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebT integer, -- February ties, example: [0, 1]\n MarL text, -- March loses, example: ['4', '0']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPC text, -- Power play chances, example: ['220', '279']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_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:\nYear most hockey players were born refers to MAX(birthYear); birthCountry refers to the country where a player was born\n\nWhich country produced the most number of hockey players? Identify which year was most of the hockey players are born.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['WIN', 'ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n OctT text, -- October ties, example: ['0', '1']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprT text, -- April ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n pos text, -- position, example: ['C', 'D']\n birthCountry text, -- example: ['Finland', 'Canada']\n deathYear text, -- example: ['1964', '2000']\n deathCountry text, -- example: ['USA', 'Canada']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['WIN', 'CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\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 ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['WIN', 'BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['WIN', 'VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['WIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['WIN', 'TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_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:\nroad victories refers to rW; team id refers to tmID; victories and wins are synonyms\n\n\nWhich team recorded the most number of road victories in 2005? Indicate the team ID.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT tmID FROM TeamSplits WHERE YEAR = '2005' ORDER BY rW DESC LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT tmID FROM TeamSplits WHERE YEAR = '2005' ORDER BY rW DESC LIMIT 1", "index": 3644, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['WIN', 'ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n OctT text, -- October ties, example: ['0', '1']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprT text, -- April ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n pos text, -- position, example: ['C', 'D']\n birthCountry text, -- example: ['Finland', 'Canada']\n deathYear text, -- example: ['1964', '2000']\n deathCountry text, -- example: ['USA', 'Canada']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['WIN', 'CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\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 ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['WIN', 'BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['WIN', 'VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['WIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['WIN', 'TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_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:\nroad victories refers to rW; team id refers to tmID; victories and wins are synonyms\n\n\nWhich team recorded the most number of road victories in 2005? Indicate the team ID.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecL text, -- December loses, example: ['1', '0']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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 TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPC text, -- Power play chances, example: ['220', '279']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nposition refers to pos; date of birth refers to birthDay + birthMon + birthYear\nWhat is the position of the 9th oldest hockey 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 pos FROM Master WHERE birthYear IS NOT NULL ORDER BY birthYear, birthMon, birthDay LIMIT 8", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT pos FROM Master WHERE birthYear IS NOT NULL ORDER BY birthYear, birthMon, birthDay LIMIT 8", "index": 3645, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecL text, -- December loses, example: ['1', '0']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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 TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPC text, -- Power play chances, example: ['220', '279']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nposition refers to pos; date of birth refers to birthDay + birthMon + birthYear\nWhat is the position of the 9th oldest hockey 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 TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Mean', 'Max', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthState text, -- example: ['GA', 'ON', 'MB']\n birthCity text, -- example: ['Most', 'Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathCountry text, -- example: ['USA', 'Canada']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['WCHL', 'PCHA']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['WCHL', 'NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['WCHL', 'NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['WCHL', 'NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['WCHL', 'NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n SOG text, -- Shots on goal, example: ['1', '61']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['WCHL', 'NHA', 'NHL']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['WCHL', 'NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebL integer, -- February loses, example: [3, 5]\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['WCHL', 'NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWCHL is the league's abbreviated name which refers to lgID = 'WCHL'; most goals scored referst to MAX(PostGA); GA is abbreviation for Post Against which means number of goals recorded while the goalie is on the ice. Include all goals against during regulation and overtime play.\nHow many goals were scored while the goalkeeper was on the ice in the 1924 WCHL by the goalie with the most goals scored?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(PostGA) FROM Goalies WHERE lgID = 'WCHL' AND year = '1924' GROUP BY playerID ORDER BY SUM(PostGA) DESC LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT SUM(PostGA) FROM Goalies WHERE lgID = 'WCHL' AND year = '1924' GROUP BY playerID ORDER BY SUM(PostGA) DESC LIMIT 1", "index": 3646, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Mean', 'Max', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthState text, -- example: ['GA', 'ON', 'MB']\n birthCity text, -- example: ['Most', 'Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathCountry text, -- example: ['USA', 'Canada']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['WCHL', 'PCHA']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['WCHL', 'NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['WCHL', 'NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['WCHL', 'NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['WCHL', 'NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n SOG text, -- Shots on goal, example: ['1', '61']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['WCHL', 'NHA', 'NHL']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['WCHL', 'NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebL integer, -- February loses, example: [3, 5]\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['WCHL', 'NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWCHL is the league's abbreviated name which refers to lgID = 'WCHL'; most goals scored referst to MAX(PostGA); GA is abbreviation for Post Against which means number of goals recorded while the goalie is on the ice. Include all goals against during regulation and overtime play.\nHow many goals were scored while the goalkeeper was on the ice in the 1924 WCHL by the goalie with the most goals scored?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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 TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameGiven text, -- example: ['Max', 'Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Max', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ID', 'ON', 'MB']\n birthCity text, -- example: ['Most', 'Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoW text, -- Shootout wins, example: ['3', '5']\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PPC text, -- Power play chances, example: ['220', '279']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_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 ID refers to tmID; 'defeats' and 'loses' are synonyms; most October defeats refers to max(OctL)\nIn 2006, what is the overall number of october defeats for the team with the most October defeats? Indicate the team ID.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT OctL, tmID FROM TeamSplits WHERE year = '2006' ORDER BY OctL DESC LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT OctL, tmID FROM TeamSplits WHERE year = '2006' ORDER BY OctL DESC LIMIT 1", "index": 3647, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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 TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameGiven text, -- example: ['Max', 'Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Max', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ID', 'ON', 'MB']\n birthCity text, -- example: ['Most', 'Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoW text, -- Shootout wins, example: ['3', '5']\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PPC text, -- Power play chances, example: ['220', '279']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_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 ID refers to tmID; 'defeats' and 'loses' are synonyms; most October defeats refers to max(OctL)\nIn 2006, what is the overall number of october defeats for the team with the most October defeats? Indicate the team ID.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postl text, -- post-season loses, example: ['4', '5']\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: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Max', 'Antti', 'Bruce']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthYear text, -- example: ['1975', '1951']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['G', 'A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['G', 'C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_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:\nmost number of goals refers to max(G); how old refers to age = subtract(year(max(G)), birthYear)\nWhich year recorded the most number of goals by a player and how old was the player at the time the most number of goals was achieved by him?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.year, T1.year - T2.birthYear FROM Scoring AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID GROUP BY T1.year, T1.year - T2.birthYear ORDER BY SUM(T1.G) DESC LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T1.year, T1.year - T2.birthYear FROM Scoring AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID GROUP BY T1.year, T1.year - T2.birthYear ORDER BY SUM(T1.G) DESC LIMIT 1", "index": 3648, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postl text, -- post-season loses, example: ['4', '5']\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: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Max', 'Antti', 'Bruce']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthYear text, -- example: ['1975', '1951']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['G', 'A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['G', 'C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_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:\nmost number of goals refers to max(G); how old refers to age = subtract(year(max(G)), birthYear)\nWhich year recorded the most number of goals by a player and how old was the player at the time the most number of goals was achieved by him?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['MIN', 'VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['MIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoW text, -- Shootout wins, example: ['3', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['MIN', 'CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['Power', 'Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n OctW text, -- October wins, example: ['0', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['MIN', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['MIN', 'ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPts text, -- Postseason points, example: ['0', '3']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['MIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) 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:\nleast number of penalty kill chances refers to min(PKC); power play percentage refers to (PP%) = divide(PPG, PPC); team playing refers to tmID; victorious team refers to tmIDWinner; team victorious refers to tmID = tmIDWinner and vice versa\nWhat is the power play percentage of the team with the least number of penalty kill chances and to which team were they playing against? Indicate whether the team lost or victorious.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.A), T2.firstName, T2.lastName FROM Scoring AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID WHERE T1.lgID = 'NHL' GROUP BY T2.firstName, T2.lastName ORDER BY SUM(T1.A) DESC LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT SUM(T1.A), T2.firstName, T2.lastName FROM Scoring AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID WHERE T1.lgID = 'NHL' GROUP BY T2.firstName, T2.lastName ORDER BY SUM(T1.A) DESC LIMIT 1", "index": 3649, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['MIN', 'VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['MIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoW text, -- Shootout wins, example: ['3', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['MIN', 'CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['Power', 'Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n OctW text, -- October wins, example: ['0', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['MIN', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['MIN', 'ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPts text, -- Postseason points, example: ['0', '3']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['MIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) 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:\nleast number of penalty kill chances refers to min(PKC); power play percentage refers to (PP%) = divide(PPG, PPC); team playing refers to tmID; victorious team refers to tmIDWinner; team victorious refers to tmID = tmIDWinner and vice versa\nWhat is the power play percentage of the team with the least number of penalty kill chances and to which team were they playing against? Indicate whether the team lost or victorious.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n shootCatch text, -- example: ['L', 'R']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Finland', 'Canada']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n DecL text, -- December loses, example: ['1', '0']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_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:\nexhibition game refers to note = 'EX'; team of losing team refers to tmIDLoser\nWhat is the name of the losing team during an exhibition game in 1912?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.name FROM SeriesPost AS T1 INNER JOIN Teams AS T2 ON T1.year = T2.year AND tmIDLoser = tmID WHERE T1.note = 'EX' AND T2.year = '1912'", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T2.name FROM SeriesPost AS T1 INNER JOIN Teams AS T2 ON T1.year = T2.year AND tmIDLoser = tmID WHERE T1.note = 'EX' AND T2.year = '1912'", "index": 3650, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n shootCatch text, -- example: ['L', 'R']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Finland', 'Canada']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n DecL text, -- December loses, example: ['1', '0']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_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:\nexhibition game refers to note = 'EX'; team of losing team refers to tmIDLoser\nWhat is the name of the losing team during an exhibition game in 1912?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPC text, -- Power play chances, example: ['39', '27']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Long', 'Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHL', 'NHA']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['NHL', 'PCHA', 'WCHL']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['MIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['MIN', 'CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['MIN', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n AprL text, -- April loses, example: ['0', '2']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['MIN', 'VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['MIN', 'QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHL', 'NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostL text, -- Postseason loses, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNHL refers to lgID = 'NHL'; least number of times being on the ice when a goal is scored for the team versus against the team refers to min(+/-); duration the player's been playing = subtract(year(playerID(min(+/-))), firstNHL(playerID(min(+/-)))); full name = nameGiven + lastName\nHow long has the NHL player been playing during the year when he recorded the least number of times being on the ice when a goal is scored for the team versus against the team? Indicate his full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT T3.firstNHL - T1.year, T3.nameGiven , T3.firstName, T3.lastName FROM Scoring AS T1 INNER JOIN Teams AS T2 ON T2.tmID = T1.tmID INNER JOIN Master AS T3 ON T1.playerID = T3.playerID GROUP BY T3.firstName, T3.lastName, T3.nameGiven, T3.firstNHL - T1.year, T3.firstName, T3.lastName ORDER BY SUM(T1.`+/-`) ASC LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT DISTINCT T3.firstNHL - T1.year, T3.nameGiven , T3.firstName, T3.lastName FROM Scoring AS T1 INNER JOIN Teams AS T2 ON T2.tmID = T1.tmID INNER JOIN Master AS T3 ON T1.playerID = T3.playerID GROUP BY T3.firstName, T3.lastName, T3.nameGiven, T3.firstNHL - T1.year, T3.firstName, T3.lastName ORDER BY SUM(T1.`+/-`) ASC LIMIT 1", "index": 3651, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPC text, -- Power play chances, example: ['39', '27']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Long', 'Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHL', 'NHA']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['NHL', 'PCHA', 'WCHL']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['MIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['MIN', 'CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['MIN', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n AprL text, -- April loses, example: ['0', '2']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['MIN', 'VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['MIN', 'QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHL', 'NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostL text, -- Postseason loses, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNHL refers to lgID = 'NHL'; least number of times being on the ice when a goal is scored for the team versus against the team refers to min(+/-); duration the player's been playing = subtract(year(playerID(min(+/-))), firstNHL(playerID(min(+/-)))); full name = nameGiven + lastName\nHow long has the NHL player been playing during the year when he recorded the least number of times being on the ice when a goal is scored for the team versus against the team? Indicate his full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['MIN', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHL', 'NHA']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n MarT text, -- March ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['MIN', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['MIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthState text, -- example: ['ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['MIN', 'VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['NHL', 'PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['MIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['MIN', 'CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_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:\ngoaltender' and 'goalie' are synonyms; fewest goals while on the ice refers to min(GA); How old = subtract(lastNHL(playerID(min(GA))), birthYear(playerID(min(GA)))))\nHow old was the goaltender who scored the fewest goals while on the ice when he retired from the NHL?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.lastNHL - T2.birthYear FROM GoaliesSC AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID WHERE T2.lastNHL IS NOT NULL GROUP BY T2.lastNHL, T2.birthYear ORDER BY SUM(GA) LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T2.lastNHL - T2.birthYear FROM GoaliesSC AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID WHERE T2.lastNHL IS NOT NULL GROUP BY T2.lastNHL, T2.birthYear ORDER BY SUM(GA) LIMIT 1", "index": 3652, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['MIN', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHL', 'NHA']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n MarT text, -- March ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['MIN', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['MIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthState text, -- example: ['ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['MIN', 'VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['NHL', 'PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['MIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['MIN', 'CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_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:\ngoaltender' and 'goalie' are synonyms; fewest goals while on the ice refers to min(GA); How old = subtract(lastNHL(playerID(min(GA))), birthYear(playerID(min(GA)))))\nHow old was the goaltender who scored the fewest goals while on the ice when he retired from the NHL?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\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 GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameGiven text, -- example: ['Max', 'Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Count', 'Max', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Most', 'Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PPG text, -- Power play goals, example: ['1', '5']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nposition has won the most awards refers to pos(max(count(award))); most recent player refers to playerID(pos(max(count(award)))& max(year)); full name = nameGiven + lastName\nWhich position has won the most awards and who is the most recent player that was awarded with an award in that position? Indicate the name of the award and 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.pos, T2.award, T1.nameGiven, T1.lastName FROM Master AS T1 INNER JOIN AwardsCoaches AS T2 ON T2.coachID = T1.coachID GROUP BY T1.pos, T2.award, T1.nameGiven, T1.lastName ORDER BY COUNT(T2.award) LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T1.pos, T2.award, T1.nameGiven, T1.lastName FROM Master AS T1 INNER JOIN AwardsCoaches AS T2 ON T2.coachID = T1.coachID GROUP BY T1.pos, T2.award, T1.nameGiven, T1.lastName ORDER BY COUNT(T2.award) LIMIT 1", "index": 3653, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\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 GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameGiven text, -- example: ['Max', 'Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Count', 'Max', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Most', 'Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PPG text, -- Power play goals, example: ['1', '5']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nposition has won the most awards refers to pos(max(count(award))); most recent player refers to playerID(pos(max(count(award)))& max(year)); full name = nameGiven + lastName\nWhich position has won the most awards and who is the most recent player that was awarded with an award in that position? Indicate the name of the award and 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 GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PPG text, -- Power play goals, example: ['1', '5']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['WIN', 'VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['WIN', 'QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctL text, -- October loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanL integer, -- January loses, example: [1, 3]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarOL text, -- March overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['WIN', 'TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['WIN', 'ANA', 'CIN']\n pos text, -- position, example: ['W', 'C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['WIN', 'CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['WIN', 'BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Max', 'Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Max', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['W', 'C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n birthCity text, -- example: ['Most', 'Lappeenranta', 'Toronto']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['W', 'C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (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 playing refers to tmID; oppositng team refers to oppID; victories' and 'wins' are synonyms; most victories refers to max(w)\nHow many teams did the team with the most victories in 1915 play against?\nIndicate the name of the team who won the most games in 1915, as well as the names of the opposing 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(DISTINCT oppID), T2.tmID, T2.oppID FROM Teams AS T1 INNER JOIN TeamVsTeam AS T2 ON T1.year = T2.year AND T1.tmID = T2.tmID WHERE T2.year = 1915 GROUP BY T2.tmID, T2.oppID ORDER BY SUM(T2.W) DESC LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT COUNT(DISTINCT oppID), T2.tmID, T2.oppID FROM Teams AS T1 INNER JOIN TeamVsTeam AS T2 ON T1.year = T2.year AND T1.tmID = T2.tmID WHERE T2.year = 1915 GROUP BY T2.tmID, T2.oppID ORDER BY SUM(T2.W) DESC LIMIT 1", "index": 3654, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PPG text, -- Power play goals, example: ['1', '5']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['WIN', 'VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['WIN', 'QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctL text, -- October loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanL integer, -- January loses, example: [1, 3]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarOL text, -- March overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['WIN', 'TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['WIN', 'ANA', 'CIN']\n pos text, -- position, example: ['W', 'C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['WIN', 'CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['WIN', 'BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Max', 'Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Max', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['W', 'C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n birthCity text, -- example: ['Most', 'Lappeenranta', 'Toronto']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['W', 'C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (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 playing refers to tmID; oppositng team refers to oppID; victories' and 'wins' are synonyms; most victories refers to max(w)\nHow many teams did the team with the most victories in 1915 play against?\nIndicate the name of the team who won the most games in 1915, as well as the names of the opposing 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 TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameGiven text, -- example: ['Max', 'Antti', 'Bruce']\n weight text, -- example: ['210', '185']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Most', 'Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n NovT text, -- November ties, example: ['0', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_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:\nshorthanded goals refers to SHG; SHG BETWEEN 1 AND 5; most trustworthy in the critical moment refers to max(GWG)\nAmong the teams whose shorthanded goals are between 1 to 5, which player is the most trustworthy in the critical moment?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.nameGiven, T2.lastName FROM Scoring AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID WHERE T1.SHG BETWEEN 1 AND 5 ORDER BY T1.GWG DESC LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T2.nameGiven, T2.lastName FROM Scoring AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID WHERE T1.SHG BETWEEN 1 AND 5 ORDER BY T1.GWG DESC LIMIT 1", "index": 3655, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameGiven text, -- example: ['Max', 'Antti', 'Bruce']\n weight text, -- example: ['210', '185']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Most', 'Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n NovT text, -- November ties, example: ['0', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_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:\nshorthanded goals refers to SHG; SHG BETWEEN 1 AND 5; most trustworthy in the critical moment refers to max(GWG)\nAmong the teams whose shorthanded goals are between 1 to 5, which player is the most trustworthy in the critical moment?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarT text, -- March ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n lastName text, -- example: ['Standing', 'Short', 'Aalto', 'Abbey']\n nameGiven text, -- example: ['Max', 'Antti', 'Bruce']\n height text, -- example: ['73', '67']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n birthCountry text, -- example: ['Finland', 'Canada']\n deathDay text, -- example: ['1', '7']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_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:\nshort handed assists refers to SHA; SHA> = 7; final standing refers to rank; the final standing of the team with the most number of assists refers to max(A)\n\nAmong the players whose short handed assists are greater or equal to 7, what is the final standing of the team with the most number of assists? Indicate the year to which the most number of assists was achieved and the 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 T2.rank, T2.year, T2.name FROM Scoring AS T1 INNER JOIN Teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.SHA >= 7 ORDER BY T1.A DESC LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T2.rank, T2.year, T2.name FROM Scoring AS T1 INNER JOIN Teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.SHA >= 7 ORDER BY T1.A DESC LIMIT 1", "index": 3656, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarT text, -- March ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n lastName text, -- example: ['Standing', 'Short', 'Aalto', 'Abbey']\n nameGiven text, -- example: ['Max', 'Antti', 'Bruce']\n height text, -- example: ['73', '67']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n birthCountry text, -- example: ['Finland', 'Canada']\n deathDay text, -- example: ['1', '7']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_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:\nshort handed assists refers to SHA; SHA> = 7; final standing refers to rank; the final standing of the team with the most number of assists refers to max(A)\n\nAmong the players whose short handed assists are greater or equal to 7, what is the final standing of the team with the most number of assists? Indicate the year to which the most number of assists was achieved and the 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 GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthState text, -- example: ['ON', 'MB']\n deathDay text, -- example: ['1', '7']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPG text, -- Power play goals, example: ['0', '2']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_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:\nyear BETWEEN 1917 AND 1920; first half of season refers to half = 1\nBetween 1917 to 1920, what are the names of the team who ranked first in the first half of the season each 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 DISTINCT T2.name FROM TeamsHalf AS T1 INNER JOIN Teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.half = 1 AND T1.rank = 1 AND T1.year BETWEEN 1917 AND 1920", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT DISTINCT T2.name FROM TeamsHalf AS T1 INNER JOIN Teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.half = 1 AND T1.rank = 1 AND T1.year BETWEEN 1917 AND 1920", "index": 3657, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthState text, -- example: ['ON', 'MB']\n deathDay text, -- example: ['1', '7']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPG text, -- Power play goals, example: ['0', '2']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_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:\nyear BETWEEN 1917 AND 1920; first half of season refers to half = 1\nBetween 1917 to 1920, what are the names of the team who ranked first in the first half of the season each 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 CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['St. Louis', 'Minor', 'Blue', 'Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Louis', 'Antti', 'Bruce']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['St. Louis', 'Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['St. Louis Blues', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\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 bench minor penalties did the team St. Louis Blues got in total in all the 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 CAST(SUM(BenchMinor) AS REAL) / 2 FROM Teams WHERE name = 'St. Louis Blues'", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT CAST(SUM(BenchMinor) AS REAL) / 2 FROM Teams WHERE name = 'St. Louis Blues'", "index": 3658, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['St. Louis', 'Minor', 'Blue', 'Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Louis', 'Antti', 'Bruce']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['St. Louis', 'Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['St. Louis Blues', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\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 bench minor penalties did the team St. Louis Blues got in total in all the 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 ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanL integer, -- January loses, example: [1, 3]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprT text, -- April ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n lastName text, -- example: ['Stanley', 'Aalto', 'Abbey']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n CONSTRAINT fk_master_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:\nteams refer to tmID; year = 1922;\nPlease list the teams that have played in 1922's Stanley Cup finals.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.name FROM TeamsSC AS T1 INNER JOIN Teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.year = '1922'", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T2.name FROM TeamsSC AS T1 INNER JOIN Teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.year = '1922'", "index": 3659, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanL integer, -- January loses, example: [1, 3]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprT text, -- April ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n lastName text, -- example: ['Stanley', 'Aalto', 'Abbey']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n CONSTRAINT fk_master_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:\nteams refer to tmID; year = 1922;\nPlease list the teams that have played in 1922's Stanley Cup finals.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n PPA text, -- Power play assists, example: ['0', '1']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['Stanley', 'Aalto', 'Abbey']\n nameGiven text, -- example: ['Stanley', 'Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_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:\nteams refer to tmID; year = 1922; ranked second refers to rank = 2; penalty minutes refer to PIM;\nWhat were the penalty minutes in 1923's Stanley Cup finals of the team that ranked second 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 T1.PIM FROM TeamsSC AS T1 INNER JOIN Teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.year = '1923' AND T2.rank = 2", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T1.PIM FROM TeamsSC AS T1 INNER JOIN Teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.year = '1923' AND T2.rank = 2", "index": 3660, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n PPA text, -- Power play assists, example: ['0', '1']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['Stanley', 'Aalto', 'Abbey']\n nameGiven text, -- example: ['Stanley', 'Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_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:\nteams refer to tmID; year = 1922; ranked second refers to rank = 2; penalty minutes refer to PIM;\nWhat were the penalty minutes in 1923's Stanley Cup finals of the team that ranked second 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 HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['WIN', 'TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['WIN', 'VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['WIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['WIN', 'BOS', 'ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPA text, -- Power play assists, example: ['0', '1']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['BOS', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['BOS', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebL integer, -- February loses, example: [3, 5]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Philadelphia Flyers', 'Boston Bruins', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['WIN', 'CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['WIN', 'BOS', 'NEW']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_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:\nPhiladelphia Flyers is name of team playing; Boston Bruins is name of opposing team where oppID = 'BOS'; year = 1985; wins refer to W;\nHow many wins did the Philadelphia Flyers have over the Boston Bruins in 1985?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.W FROM TeamVsTeam AS T1 INNER JOIN Teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.year = 1985 AND T1.tmID = ( SELECT DISTINCT tmID FROM Teams WHERE name = 'Philadelphia Flyers' ) AND T1.oppID = ( SELECT DISTINCT tmID FROM Teams WHERE name = 'Boston Bruins' )", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T1.W FROM TeamVsTeam AS T1 INNER JOIN Teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.year = 1985 AND T1.tmID = ( SELECT DISTINCT tmID FROM Teams WHERE name = 'Philadelphia Flyers' ) AND T1.oppID = ( SELECT DISTINCT tmID FROM Teams WHERE name = 'Boston Bruins' )", "index": 3661, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['WIN', 'TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['WIN', 'VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['WIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['WIN', 'BOS', 'ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPA text, -- Power play assists, example: ['0', '1']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['BOS', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['BOS', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebL integer, -- February loses, example: [3, 5]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Philadelphia Flyers', 'Boston Bruins', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['WIN', 'CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['WIN', 'BOS', 'NEW']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_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:\nPhiladelphia Flyers is name of team playing; Boston Bruins is name of opposing team where oppID = 'BOS'; year = 1985; wins refer to W;\nHow many wins did the Philadelphia Flyers have over the Boston Bruins in 1985?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n GWG text, -- Game-winning goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\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 GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Tie', 'T', 'Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNick text, -- Nickname, example: ['T', 'Preacher', 'Taffy']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_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:\ntie refers to T>0; year = 1909;\nPlease list the names of the teams that had a tie in 1909.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.name, T3.name FROM TeamVsTeam AS T1 INNER JOIN Teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year INNER JOIN Teams AS T3 ON T1.year = T3.year AND T1.oppID = T3.tmID WHERE T1.year = 1909 AND T1.T = 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T2.name, T3.name FROM TeamVsTeam AS T1 INNER JOIN Teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year INNER JOIN Teams AS T3 ON T1.year = T3.year AND T1.oppID = T3.tmID WHERE T1.year = 1909 AND T1.T = 1", "index": 3662, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n GWG text, -- Game-winning goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\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 GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Tie', 'T', 'Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNick text, -- Nickname, example: ['T', 'Preacher', 'Taffy']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_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:\ntie refers to T>0; year = 1909;\nPlease list the names of the teams that had a tie in 1909.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPG text, -- Power play goals, example: ['0', '2']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n name text, -- Full team name, example: ['Montreal Canadiens', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PPC text, -- Power play chances, example: ['39', '27']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\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 CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n OctL text, -- October loses, example: ['1', '0']\n NovOL text, -- November overtime loses, example: ['0', '2']\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n height text, -- example: ['73', '67']\n birthCity text, -- example: ['Montreal', 'Lappeenranta', 'Toronto']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMontreal Canadiens is the name of team.\nPlease list the first names of the coaches who have taught the Montreal Canadiens.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 FROM Coaches AS T1 INNER JOIN Teams AS T2 ON T1.year = T2.year AND T1.tmID = T2.tmID INNER JOIN Master AS T3 ON T1.coachID = T3.coachID WHERE T2.name = 'Montreal Canadiens'", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT DISTINCT T3.firstName FROM Coaches AS T1 INNER JOIN Teams AS T2 ON T1.year = T2.year AND T1.tmID = T2.tmID INNER JOIN Master AS T3 ON T1.coachID = T3.coachID WHERE T2.name = 'Montreal Canadiens'", "index": 3663, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPG text, -- Power play goals, example: ['0', '2']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n name text, -- Full team name, example: ['Montreal Canadiens', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PPC text, -- Power play chances, example: ['39', '27']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\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 CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n OctL text, -- October loses, example: ['1', '0']\n NovOL text, -- November overtime loses, example: ['0', '2']\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n height text, -- example: ['73', '67']\n birthCity text, -- example: ['Montreal', 'Lappeenranta', 'Toronto']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMontreal Canadiens is the name of team.\nPlease list the first names of the coaches who have taught the Montreal Canadiens.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n name text, -- Full team name, example: ['Montreal Canadiens', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n height text, -- example: ['73', '67']\n shootCatch text, -- example: ['L', 'R']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n pos text, -- position, example: ['C', 'D']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepT text, -- September ties\n OctT text, -- October ties, example: ['0', '1']\n NovL text, -- November loses, example: ['1', '4']\n DecW text, -- December wins, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['59', '68']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\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 ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe tallest refers to MAX(height); Montreal Canadiens is the name of team;\nPlease give the height of the tallest coach of the Montreal Canadiens.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T3.height FROM Coaches AS T1 INNER JOIN Teams AS T2 ON T1.year = T2.year AND T1.tmID = T2.tmID INNER JOIN Master AS T3 ON T1.coachID = T3.coachID WHERE T2.name = 'Montreal Canadiens' AND T3.coachID IS NOT NULL ORDER BY T3.height DESC LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T3.height FROM Coaches AS T1 INNER JOIN Teams AS T2 ON T1.year = T2.year AND T1.tmID = T2.tmID INNER JOIN Master AS T3 ON T1.coachID = T3.coachID WHERE T2.name = 'Montreal Canadiens' AND T3.coachID IS NOT NULL ORDER BY T3.height DESC LIMIT 1", "index": 3664, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n name text, -- Full team name, example: ['Montreal Canadiens', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n height text, -- example: ['73', '67']\n shootCatch text, -- example: ['L', 'R']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n pos text, -- position, example: ['C', 'D']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepT text, -- September ties\n OctT text, -- October ties, example: ['0', '1']\n NovL text, -- November loses, example: ['1', '4']\n DecW text, -- December wins, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['59', '68']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\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 ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe tallest refers to MAX(height); Montreal Canadiens is the name of team;\nPlease give the height of the tallest coach of the Montreal Canadiens.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n name text, -- Full team name, example: ['Philadelphia Flyers', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n pos text, -- position, example: ['C', 'D']\n birthCountry text, -- example: ['USA', 'Finland', 'Canada']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rT integer, -- Road ties, example: [0, 1]\n SepT text, -- September ties\n OctT text, -- October ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n SHA text, -- Shorthanded assists, example: ['0', '1']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_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:\nborn in the USA refers to birthCountry = 'USA'; Philadelphia Flyers is the name of team;\nAmong the coaches who are born in the USA, how many of them used to train the Philadelphia Flyers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.coachID) FROM Coaches AS T1 INNER JOIN Teams AS T2 ON T1.year = T2.year AND T1.tmID = T2.tmID INNER JOIN Master AS T3 ON T1.coachID = T3.coachID WHERE T2.name = 'Philadelphia Flyers' AND T3.birthCountry = 'USA'", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T3.coachID) FROM Coaches AS T1 INNER JOIN Teams AS T2 ON T1.year = T2.year AND T1.tmID = T2.tmID INNER JOIN Master AS T3 ON T1.coachID = T3.coachID WHERE T2.name = 'Philadelphia Flyers' AND T3.birthCountry = 'USA'", "index": 3665, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n name text, -- Full team name, example: ['Philadelphia Flyers', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n pos text, -- position, example: ['C', 'D']\n birthCountry text, -- example: ['USA', 'Finland', 'Canada']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rT integer, -- Road ties, example: [0, 1]\n SepT text, -- September ties\n OctT text, -- October ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n SHA text, -- Shorthanded assists, example: ['0', '1']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_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:\nborn in the USA refers to birthCountry = 'USA'; Philadelphia Flyers is the name of team;\nAmong the coaches who are born in the USA, how many of them used to train the Philadelphia Flyers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Buffalo Sabres', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPG text, -- Power play goals, example: ['28', '51']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepT text, -- September ties\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecL text, -- December loses, example: ['1', '0']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n FebT integer, -- February ties, example: [0, 1]\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameGiven text, -- example: ['Antti', 'Bruce']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Buffalo', 'Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathCity text, -- example: ['Buffalo', 'Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave died means deathYear is not NULL; Buffalo Sabres is the name of team;\nHow many coaches who have taught the Buffalo Sabres have died?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.coachID) FROM Coaches AS T1 INNER JOIN Teams AS T2 ON T1.year = T2.year AND T1.tmID = T2.tmID INNER JOIN Master AS T3 ON T1.coachID = T3.coachID WHERE T2.name = 'Buffalo Sabres' AND T3.deathYear IS NOT NULL", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T3.coachID) FROM Coaches AS T1 INNER JOIN Teams AS T2 ON T1.year = T2.year AND T1.tmID = T2.tmID INNER JOIN Master AS T3 ON T1.coachID = T3.coachID WHERE T2.name = 'Buffalo Sabres' AND T3.deathYear IS NOT NULL", "index": 3666, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Buffalo Sabres', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPG text, -- Power play goals, example: ['28', '51']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepT text, -- September ties\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecL text, -- December loses, example: ['1', '0']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n FebT integer, -- February ties, example: [0, 1]\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameGiven text, -- example: ['Antti', 'Bruce']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Buffalo', 'Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathCity text, -- example: ['Buffalo', 'Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave died means deathYear is not NULL; Buffalo Sabres is the name of team;\nHow many coaches who have taught the Buffalo Sabres have died?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PPC text, -- Power play chances, example: ['39', '27']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n SepW text, -- September wins, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PPG text, -- Power play goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n shootCatch text, -- example: ['L', 'R']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n birthCity text, -- example: ['Buffalo', 'Lappeenranta', 'Toronto']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Buffalo Sabres', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postl text, -- post-season loses, example: ['4', '5']\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 ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteams that have played against refer to oppID; Buffalo Sabres is the name of team;\nPlease list the names of all the teams that have played against the Buffalo Sabres.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.name FROM TeamVsTeam AS T1 INNER JOIN Teams AS T2 ON T1.year = T2.year AND T1.oppID = T2.tmID INNER JOIN Teams AS T3 ON T1.year = T3.year AND T1.tmID = T3.tmID WHERE T2.name = 'Buffalo Sabres'", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT DISTINCT T3.name FROM TeamVsTeam AS T1 INNER JOIN Teams AS T2 ON T1.year = T2.year AND T1.oppID = T2.tmID INNER JOIN Teams AS T3 ON T1.year = T3.year AND T1.tmID = T3.tmID WHERE T2.name = 'Buffalo Sabres'", "index": 3667, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PPC text, -- Power play chances, example: ['39', '27']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n SepW text, -- September wins, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PPG text, -- Power play goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n shootCatch text, -- example: ['L', 'R']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n birthCity text, -- example: ['Buffalo', 'Lappeenranta', 'Toronto']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Buffalo Sabres', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postl text, -- post-season loses, example: ['4', '5']\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 ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteams that have played against refer to oppID; Buffalo Sabres is the name of team;\nPlease list the names of all the teams that have played against the Buffalo Sabres.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepL text, -- September loses, example: ['1']\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n lastName text, -- example: ['Stanley', 'Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Stanley', 'Antti', 'Bruce']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Montreal', 'Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathCity text, -- example: ['Montreal', 'Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Montreal Canadiens', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npenalty minutes refer to PIM; year = 1918; Montreal Canadiens is name of team;\nHow many penalty minutes did the Montreal Canadiens have in the 1918's Stanley Cup Finals?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.PIM FROM Teams AS T1 INNER JOIN TeamsSC AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.name = 'Montreal Canadiens' AND T1.year = 1918", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T2.PIM FROM Teams AS T1 INNER JOIN TeamsSC AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.name = 'Montreal Canadiens' AND T1.year = 1918", "index": 3668, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepL text, -- September loses, example: ['1']\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n lastName text, -- example: ['Stanley', 'Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Stanley', 'Antti', 'Bruce']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Montreal', 'Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathCity text, -- example: ['Montreal', 'Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Montreal Canadiens', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npenalty minutes refer to PIM; year = 1918; Montreal Canadiens is name of team;\nHow many penalty minutes did the Montreal Canadiens have in the 1918's Stanley Cup Finals?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Stanley Cup Finals', 'Finals', 'Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['WIN', 'ANA', 'CIN']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['WIN', 'CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n nameGiven text, -- example: ['Stanley', 'Antti', 'Bruce']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['W', 'C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Montreal', 'Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n AprT text, -- April ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['WIN', 'TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['WIN', 'VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['WIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n name text, -- Full team name, example: ['Montreal Canadiens', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['WIN', 'BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npenalty minutes refer to PIM = 24; wins refer to W;\nIn the year that the Montreal Canadiens had 24 penalty minutes in the Stanley Cup finals, how many wins did the team had in total?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.W FROM Teams AS T1 INNER JOIN TeamsSC AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.name = 'Montreal Canadiens' AND T2.PIM = 24", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T2.W FROM Teams AS T1 INNER JOIN TeamsSC AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.name = 'Montreal Canadiens' AND T2.PIM = 24", "index": 3669, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Stanley Cup Finals', 'Finals', 'Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['WIN', 'ANA', 'CIN']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['WIN', 'CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n nameGiven text, -- example: ['Stanley', 'Antti', 'Bruce']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['W', 'C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Montreal', 'Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n AprT text, -- April ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['WIN', 'TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['WIN', 'VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['WIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n name text, -- Full team name, example: ['Montreal Canadiens', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['WIN', 'BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npenalty minutes refer to PIM = 24; wins refer to W;\nIn the year that the Montreal Canadiens had 24 penalty minutes in the Stanley Cup finals, how many wins did the team had in total?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['Stanley', 'Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Stanley', 'Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Stanley Cup Finals', 'Finals', 'Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n name text, -- Full team name, example: ['Montreal Canadiens', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_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:\npenalty minutes refer to PIM = 49;\nIn which year did the Montreal Canadiens have 49 penalty minutes in the Stanley Cup finals? Was it 1924, 1923 or 1918?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.year FROM Teams AS T1 INNER JOIN TeamsSC AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.name = 'Montreal Canadiens' AND T2.PIM = 49", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T1.year FROM Teams AS T1 INNER JOIN TeamsSC AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.name = 'Montreal Canadiens' AND T2.PIM = 49", "index": 3670, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['Stanley', 'Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Stanley', 'Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Stanley Cup Finals', 'Finals', 'Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n name text, -- Full team name, example: ['Montreal Canadiens', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_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:\npenalty minutes refer to PIM = 49;\nIn which year did the Montreal Canadiens have 49 penalty minutes in the Stanley Cup finals? Was it 1924, 1923 or 1918?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['MIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n name text, -- Full team name, example: ['Montreal Canadiens', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['MIN', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['MIN', 'CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postt text, -- post-season ties, example: ['0', '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 Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['MIN', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['MIN', 'VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['MIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthState text, -- example: ['ON', 'MB']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n NovW text, -- November wins, example: ['5', '1']\n DecT text, -- December ties, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe first one refers to MIN(year);\nWhich coach was the first one to teach the Montreal Canadiens, please give his first name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T3.firstName FROM Coaches AS T1 INNER JOIN Teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year INNER JOIN Master AS T3 ON T1.coachID = T3.coachID WHERE T2.name = 'Montreal Canadiens' ORDER BY T1.year LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T3.firstName FROM Coaches AS T1 INNER JOIN Teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year INNER JOIN Master AS T3 ON T1.coachID = T3.coachID WHERE T2.name = 'Montreal Canadiens' ORDER BY T1.year LIMIT 1", "index": 3671, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['MIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n name text, -- Full team name, example: ['Montreal Canadiens', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['MIN', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['MIN', 'CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postt text, -- post-season ties, example: ['0', '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 Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['MIN', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['MIN', 'VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['MIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthState text, -- example: ['ON', 'MB']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n NovW text, -- November wins, example: ['5', '1']\n DecT text, -- December ties, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe first one refers to MIN(year);\nWhich coach was the first one to teach the Montreal Canadiens, please give his first name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['WIN', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['G', 'A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['WIN', 'VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['WIN', 'QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['G', 'R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['WIN', 'TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Count', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthDay text, -- example: ['4', '18']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathCity text, -- example: ['Montreal', 'Buffalo', 'Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['WIN', 'BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['WIN', 'CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Montreal Canadiens', 'Buffalo Sabres', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctT text, -- October ties, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_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:\nDIVIDE(SUM(DIVIDE(W,G), COUNT(oppID) where year = 2000; Montreal Canadiens is name of team;\nWhat is the average winning rate of the Buffalo Sabres in 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 SUM(CAST(T2.W AS REAL) / T2.G) / COUNT(T1.oppID) FROM TeamVsTeam AS T1 INNER JOIN Teams AS T2 ON T1.year = T2.year AND T1.tmID = T2.tmID WHERE T2.name = 'Buffalo Sabres' AND T1.year = 2000", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT SUM(CAST(T2.W AS REAL) / T2.G) / COUNT(T1.oppID) FROM TeamVsTeam AS T1 INNER JOIN Teams AS T2 ON T1.year = T2.year AND T1.tmID = T2.tmID WHERE T2.name = 'Buffalo Sabres' AND T1.year = 2000", "index": 3672, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['WIN', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['G', 'A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['WIN', 'VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['WIN', 'QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['G', 'R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['WIN', 'TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Count', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthDay text, -- example: ['4', '18']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathCity text, -- example: ['Montreal', 'Buffalo', 'Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['WIN', 'BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['WIN', 'CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Montreal Canadiens', 'Buffalo Sabres', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctT text, -- October ties, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_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:\nDIVIDE(SUM(DIVIDE(W,G), COUNT(oppID) where year = 2000; Montreal Canadiens is name of team;\nWhat is the average winning rate of the Buffalo Sabres in 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 SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['G', 'C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n pos text, -- position, example: ['G', 'C', 'D']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n deathMon text, -- death month, example: ['8', '2']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n GA text, -- Goals against, example: ['7', '47']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepOL text, -- September overtime loses, example: ['0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovT text, -- November ties, example: ['0', '1']\n JanOL text, -- January overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n GWG text, -- Game-winning goals, example: ['0', '1']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Montreal Canadiens', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PKG text, -- Power play goals against, example: ['45', '43']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\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 AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['G', 'R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_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:\nAVG(PIM) = DIVIDE(SUM(PIM), COUNT(G)); Montreal Canadiens is name of team;\nHow many penalty minutes did the Montreal Canadiens have on average in the Stanley Cup Finals?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.PIM) AS REAL) / COUNT(T2.PIM) FROM Teams AS T1 INNER JOIN TeamsSC AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.name = 'Montreal Canadiens'", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT CAST(SUM(T2.PIM) AS REAL) / COUNT(T2.PIM) FROM Teams AS T1 INNER JOIN TeamsSC AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.name = 'Montreal Canadiens'", "index": 3673, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['G', 'C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n pos text, -- position, example: ['G', 'C', 'D']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n deathMon text, -- death month, example: ['8', '2']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n GA text, -- Goals against, example: ['7', '47']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepOL text, -- September overtime loses, example: ['0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovT text, -- November ties, example: ['0', '1']\n JanOL text, -- January overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n GWG text, -- Game-winning goals, example: ['0', '1']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Montreal Canadiens', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PKG text, -- Power play goals against, example: ['45', '43']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\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 AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['G', 'R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_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:\nAVG(PIM) = DIVIDE(SUM(PIM), COUNT(G)); Montreal Canadiens is name of team;\nHow many penalty minutes did the Montreal Canadiens have on average in the Stanley Cup Finals?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Montreal Canadiens', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPG text, -- Power play goals, example: ['0', '2']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Count', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n legendsID text, -- example: ['14862', '18411']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['USA', 'Finland', 'Canada']\n birthCity text, -- example: ['Montreal', 'Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathCity text, -- example: ['Montreal', 'Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_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:\nAmerican refers to birthCountry = 'USA'; DIVIDE(COUNT(coachID where birthCountry = 'USA', name` = 'Montreal Canadiens'), COUNT(coachID where name` = 'Montreal Canadiens')) as percentage;\nWhat is the percentage of American coaches among all the coaches who taught the Montreal Canadiens?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(CAST(T2.W AS REAL) / T2.G) / SUM(T2.G + T2.W) FROM Teams AS T1 INNER JOIN TeamsSC AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.name = 'Montreal Canadiens'", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT SUM(CAST(T2.W AS REAL) / T2.G) / SUM(T2.G + T2.W) FROM Teams AS T1 INNER JOIN TeamsSC AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.name = 'Montreal Canadiens'", "index": 3674, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Montreal Canadiens', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPG text, -- Power play goals, example: ['0', '2']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Count', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n legendsID text, -- example: ['14862', '18411']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['USA', 'Finland', 'Canada']\n birthCity text, -- example: ['Montreal', 'Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathCity text, -- example: ['Montreal', 'Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_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:\nAmerican refers to birthCountry = 'USA'; DIVIDE(COUNT(coachID where birthCountry = 'USA', name` = 'Montreal Canadiens'), COUNT(coachID where name` = 'Montreal Canadiens')) as percentage;\nWhat is the percentage of American coaches among all the coaches who taught the Montreal Canadiens?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n NovW text, -- November wins, example: ['5', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanT integer, -- January ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n height text, -- example: ['73', '67']\n birthDay text, -- example: ['4', '18']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\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 CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhall of famers refers to hofID; players stand for category;\nIn the year 1958, what is the total number of players that became hall of famers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(hofID) FROM HOF WHERE category = 'Player' AND year = 1958", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT COUNT(hofID) FROM HOF WHERE category = 'Player' AND year = 1958", "index": 3675, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n NovW text, -- November wins, example: ['5', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanT integer, -- January ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n height text, -- example: ['73', '67']\n birthDay text, -- example: ['4', '18']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\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 CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhall of famers refers to hofID; players stand for category;\nIn the year 1958, what is the total number of players that became hall of famers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n nameNick text, -- Nickname, example: ['Mean', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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 AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PKG text, -- Power play goals against, example: ['45', '43']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecL text, -- December loses, example: ['1', '0']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n PPG text, -- Power play goals, example: ['1', '5']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_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:\nhall of famers refers to hofID; both played and coached means playerID is not NULL and coachID is not NULL;\nHow many hall of famers both played and coached in the league?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(playerID) FROM Master WHERE hofID IS NOT NULL AND playerID IS NOT NULL AND coachID IS NOT NULL", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT COUNT(playerID) FROM Master WHERE hofID IS NOT NULL AND playerID IS NOT NULL AND coachID IS NOT NULL", "index": 3676, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n nameNick text, -- Nickname, example: ['Mean', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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 AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PKG text, -- Power play goals against, example: ['45', '43']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecL text, -- December loses, example: ['1', '0']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n PPG text, -- Power play goals, example: ['1', '5']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_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:\nhall of famers refers to hofID; both played and coached means playerID is not NULL and coachID is not NULL;\nHow many hall of famers both played and coached in the league?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['QUN', 'VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QUN', 'QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QUN', 'COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['QUN', 'CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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 Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['QUN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['QUN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['QUN', 'TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QUN', 'COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n MarL text, -- March loses, example: ['4', '0']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['QUN', 'BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['QUN', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_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 dominant hand refers to shootCatch; year = 1973; tmID = 'QUN'; played 32 games refers to GP = 32;\nWhich was the dominant hand for the goaltender who played 32 games for QUN in 1973? Give the full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.shootCatch, T2.firstName, T2.lastName FROM Goalies AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID AND T1.year = 1973 WHERE T1.tmID = 'QUN' AND T1.GP = 32", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T2.shootCatch, T2.firstName, T2.lastName FROM Goalies AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID AND T1.year = 1973 WHERE T1.tmID = 'QUN' AND T1.GP = 32", "index": 3677, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['QUN', 'VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QUN', 'QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QUN', 'COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['QUN', 'CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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 Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['QUN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['QUN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['QUN', 'TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QUN', 'COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n MarL text, -- March loses, example: ['4', '0']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['QUN', 'BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['QUN', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_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 dominant hand refers to shootCatch; year = 1973; tmID = 'QUN'; played 32 games refers to GP = 32;\nWhich was the dominant hand for the goaltender who played 32 games for QUN in 1973? Give the full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PPG text, -- Power play goals, example: ['1', '5']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Young', 'Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n height text, -- example: ['73', '67']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngoalie is a players; teams refer to tmID;\nFor the goalie whose last name is \"Young\", how many teams did he 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 COUNT(DISTINCT T1.tmID) FROM Goalies AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID WHERE T2.lastName = 'Young'", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T1.tmID) FROM Goalies AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID WHERE T2.lastName = 'Young'", "index": 3678, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PPG text, -- Power play goals, example: ['1', '5']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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 TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Young', 'Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n height text, -- example: ['73', '67']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngoalie is a players; teams refer to tmID;\nFor the goalie whose last name is \"Young\", how many teams did he 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 TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['BOS', 'CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\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 Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Bo', 'Antti', 'Bruce']\n lastName text, -- example: ['Hall', 'Aalto', 'Abbey']\n nameGiven text, -- example: ['Bo', 'Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Mean', 'Bo', 'Preacher', 'Taffy']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['BOS', 'TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['BOS', 'NYA']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['BOS', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostPts text, -- Postseason points, example: ['0', '3']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_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:\nBOS refers to tmID = 'BOS'; year = 1972; became a coach than a Hall of Famer means coachID is not NULL and hofID is NULL;\nFor the goalkeeper that became a coach than a Hall of Famer, who played for BOS in 1972?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.firstName, T2.lastName , IIF(T1.tmID = 'BOS', 'YES', 'NO') FROM Goalies AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID WHERE T1.year = 1972 AND T1.tmID = 'BOS' AND T2.coachID IS NOT NULL AND T2.hofID IS NULL", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T2.firstName, T2.lastName , IIF(T1.tmID = 'BOS', 'YES', 'NO') FROM Goalies AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID WHERE T1.year = 1972 AND T1.tmID = 'BOS' AND T2.coachID IS NOT NULL AND T2.hofID IS NULL", "index": 3679, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['BOS', 'CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\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 Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Bo', 'Antti', 'Bruce']\n lastName text, -- example: ['Hall', 'Aalto', 'Abbey']\n nameGiven text, -- example: ['Bo', 'Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Mean', 'Bo', 'Preacher', 'Taffy']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['BOS', 'TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['BOS', 'NYA']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['BOS', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostPts text, -- Postseason points, example: ['0', '3']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_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:\nBOS refers to tmID = 'BOS'; year = 1972; became a coach than a Hall of Famer means coachID is not NULL and hofID is NULL;\nFor the goalkeeper that became a coach than a Hall of Famer, who played for BOS in 1972?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['HI', 'MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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 CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n SHA text, -- Shorthanded assists, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hT integer, -- home ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n MarW text, -- March wins, example: ['1', '3']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_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 shutouts refer to MAX(SHO); catching hand refers to shootCatch; year = 2010;\nFor the goalie who had the most shutouts in 2010, what's his catching hand?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.shootCatch FROM Goalies AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID WHERE T1.year = 2010 GROUP BY T2.shootCatch ORDER BY SUM(T1.SHO) DESC LIMIT 1", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT T2.shootCatch FROM Goalies AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID WHERE T1.year = 2010 GROUP BY T2.shootCatch ORDER BY SUM(T1.SHO) DESC LIMIT 1", "index": 3680, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['HI', 'MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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 CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n SHA text, -- Shorthanded assists, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hT integer, -- home ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n MarW text, -- March wins, example: ['1', '3']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_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 shutouts refer to MAX(SHO); catching hand refers to shootCatch; year = 2010;\nFor the goalie who had the most shutouts in 2010, what's his catching hand?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovT text, -- November ties, example: ['0', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 CombinedShutouts (\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ID', 'ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_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:\naverage height of 75 refers to AVG(height) = 75;\nState the player ID of player with average height of 75.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 playerID FROM Master GROUP BY playerID HAVING AVG(height) = 75", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT DISTINCT playerID FROM Master GROUP BY playerID HAVING AVG(height) = 75", "index": 3681, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovT text, -- November ties, example: ['0', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postt text, -- post-season ties, example: ['0', '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 CombinedShutouts (\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ID', 'ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_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:\naverage height of 75 refers to AVG(height) = 75;\nState the player ID of player with average height of 75.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepL text, -- September loses, example: ['1']\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n AprL text, -- April loses, example: ['0', '2']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n PPC text, -- Power play chances, example: ['39', '27']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Finland', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\norigin from Finland refers to birthCountry = 'Finland';\nWhat is the full name of players origin from Finland?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT firstName, lastName FROM Master WHERE birthCountry = 'Finland'", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT DISTINCT firstName, lastName FROM Master WHERE birthCountry = 'Finland'", "index": 3682, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepL text, -- September loses, example: ['1']\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n AprL text, -- April loses, example: ['0', '2']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n PPC text, -- Power play chances, example: ['39', '27']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Finland', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\norigin from Finland refers to birthCountry = 'Finland';\nWhat is the full name of players origin from Finland?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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 ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebL integer, -- February loses, example: [3, 5]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Mean', 'Preacher', 'Taffy']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ID', 'ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKC text, -- Penalty kill chances, example: ['242', '301']\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:\npassed away means deathYear is not NULL;\nList down player ID of players who have passed away.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 playerID FROM Master WHERE deathYear IS NOT NULL AND playerID IS NOT NULL", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT DISTINCT playerID FROM Master WHERE deathYear IS NOT NULL AND playerID IS NOT NULL", "index": 3683, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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 ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebL integer, -- February loses, example: [3, 5]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Mean', 'Preacher', 'Taffy']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ID', 'ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKC text, -- Penalty kill chances, example: ['242', '301']\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:\npassed away means deathYear is not NULL;\nList down player ID of players who have passed away.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n lastName text, -- example: ['Aalto', 'Abbey']\n shootCatch text, -- example: ['L', 'R']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n birthMon text, -- birth Month, example: ['3', '8']\n birthState text, -- example: ['ID', 'ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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 TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE CombinedShutouts (\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n GA integer, -- Goals against, example: [104, 83]\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPA text, -- Power play assists, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (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 who has not been a player means playerID is NULL and coachID is not NULL;\nIs there any coach who has not been a player before but has won award? State the ID.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT T2.coachID FROM Master AS T1 INNER JOIN AwardsCoaches AS T2 ON T1.coachID = T2.coachID WHERE T1.playerID IS NULL", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT DISTINCT T2.coachID FROM Master AS T1 INNER JOIN AwardsCoaches AS T2 ON T1.coachID = T2.coachID WHERE T1.playerID IS NULL", "index": 3684, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n lastName text, -- example: ['Aalto', 'Abbey']\n shootCatch text, -- example: ['L', 'R']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n birthMon text, -- birth Month, example: ['3', '8']\n birthState text, -- example: ['ID', 'ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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 TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE CombinedShutouts (\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n GA integer, -- Goals against, example: [104, 83]\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPA text, -- Power play assists, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (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 who has not been a player means playerID is NULL and coachID is not NULL;\nIs there any coach who has not been a player before but has won award? State the ID.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['L', 'A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['L', 'R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['L', 'C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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 AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['Weight', 'More', 'Aalto', 'Abbey']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['L', 'C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Finland', 'Canada']\n deathDay text, -- example: ['1', '7']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n MarW text, -- March wins, example: ['1', '3']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nleft winger refers to pos = 'L'; weight>200\nWhich player ID are left winger and weight more than 200?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 playerID FROM Master WHERE pos LIKE '%L%' AND weight > 200 AND playerID IS NOT NULL AND pos = 'L'", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT DISTINCT playerID FROM Master WHERE pos LIKE '%L%' AND weight > 200 AND playerID IS NOT NULL AND pos = 'L'", "index": 3685, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['L', 'A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['L', 'R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['L', 'C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\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 AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['Weight', 'More', 'Aalto', 'Abbey']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n pos text, -- position, example: ['L', 'C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Finland', 'Canada']\n deathDay text, -- example: ['1', '7']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n MarW text, -- March wins, example: ['1', '3']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nleft winger refers to pos = 'L'; weight>200\nWhich player ID are left winger and weight more than 200?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['WIN', 'TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['WIN', 'ANA', 'CIN']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPA text, -- Power play assists, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PPC text, -- Power play chances, example: ['39', '27']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['WIN', 'CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postt text, -- post-season ties, example: ['0', '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 ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['WIN', 'BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n nameNick text, -- Nickname, example: ['Count', 'Max', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepL text, -- September loses, example: ['1']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecT text, -- December ties, example: ['0', '1']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n AprW text, -- April wins, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['WIN', 'VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['WIN', 'QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_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:\nMAX(DIVIDE(COUNT(W), SUM(COUNT(W), (COUNT (L)) where year = 2000;\nWhich team has the highest winning rate in year 2000? State the team ID and list down the birth country of it's 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 DISTINCT T3.tmID, T1.birthCountry FROM Master AS T1 INNER JOIN Scoring AS T2 ON T1.playerID = T2.playerID INNER JOIN ( SELECT year, tmID FROM Teams WHERE year = 2000 ORDER BY W / (W + L) DESC LIMIT 1 ) AS T3 ON T2.tmID = T3.tmID AND T2.year = T3.year", "style": "rule" }
{ "db_id": "hockey.sqlite", "gt_sql": "SELECT DISTINCT T3.tmID, T1.birthCountry FROM Master AS T1 INNER JOIN Scoring AS T2 ON T1.playerID = T2.playerID INNER JOIN ( SELECT year, tmID FROM Teams WHERE year = 2000 ORDER BY W / (W + L) DESC LIMIT 1 ) AS T3 ON T2.tmID = T3.tmID AND T2.year = T3.year", "index": 3686, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['WIN', 'TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['WIN', 'ANA', 'CIN']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPA text, -- Power play assists, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PPC text, -- Power play chances, example: ['39', '27']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['WIN', 'CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postt text, -- post-season ties, example: ['0', '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 ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['WIN', 'BOS', 'NEW']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n nameNick text, -- Nickname, example: ['Count', 'Max', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['WIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPC text, -- Power play chances, example: ['220', '279']\n PKG text, -- Power play goals against, example: ['45', '43']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['WIN', 'COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepL text, -- September loses, example: ['1']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecT text, -- December ties, example: ['0', '1']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n AprW text, -- April wins, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['WIN', 'VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['WIN', 'QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_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:\nMAX(DIVIDE(COUNT(W), SUM(COUNT(W), (COUNT (L)) where year = 2000;\nWhich team has the highest winning rate in year 2000? State the team ID and list down the birth country of it's 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 Country (\n Code text, -- example: ['USA', 'ABW', 'AFG']\n Continent text, -- example: ['North America', 'Asia']\n IndepYear integer, -- Independence Year, example: [1919, 1975]\n GNP real, -- Gross National Product, example: [828.0, 5976.0]\n GNPOld real, -- Gross National Product Old, example: [793.0, 7984.0]\n GovernmentForm text, -- example: ['Nonmetropolitan Territory of The Netherl', 'Islamic Emirate']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['USA', 'ABW', 'AFG']\n `Language` text, -- example: ['Dutch', 'English']\n Percentage real, -- example: [5.3, 9.5]\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE City (\n ID integer, -- example: [1, 2]\n Name text, -- example: ['Kabul', 'Qandahar']\n CountryCode text, -- example: ['USA', 'AFG', 'NLD']\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUSA refers to CountryCode = 'USA';\nList the languages used in 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 Language FROM CountryLanguage WHERE CountryCode = 'USA'", "style": "rule" }
{ "db_id": "world.sqlite", "gt_sql": "SELECT Language FROM CountryLanguage WHERE CountryCode = 'USA'", "index": 3687, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Country (\n Code text, -- example: ['USA', 'ABW', 'AFG']\n Continent text, -- example: ['North America', 'Asia']\n IndepYear integer, -- Independence Year, example: [1919, 1975]\n GNP real, -- Gross National Product, example: [828.0, 5976.0]\n GNPOld real, -- Gross National Product Old, example: [793.0, 7984.0]\n GovernmentForm text, -- example: ['Nonmetropolitan Territory of The Netherl', 'Islamic Emirate']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['USA', 'ABW', 'AFG']\n `Language` text, -- example: ['Dutch', 'English']\n Percentage real, -- example: [5.3, 9.5]\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE City (\n ID integer, -- example: [1, 2]\n Name text, -- example: ['Kabul', 'Qandahar']\n CountryCode text, -- example: ['USA', 'AFG', 'NLD']\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUSA refers to CountryCode = 'USA';\nList the languages used in 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 City (\n ID integer, -- example: [1, 2]\n Name text, -- example: ['Kabul', 'Qandahar']\n CountryCode text, -- example: ['AFG', 'NLD']\n District text, -- example: ['Kabol', 'Qandahar']\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['ABW', 'AFG']\n `Language` text, -- example: ['Dutch', 'English']\n IsOfficial text, -- example: ['T', 'F']\n Percentage real, -- example: [5.3, 9.5]\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE Country (\n Code text, -- example: ['ABW', 'AFG']\n Name text, -- example: ['Turkmenistan', 'Aruba', 'Afghanistan']\n Region text, -- example: ['Caribbean', 'Southern and Central Asia']\n LifeExpectancy real, -- example: [78.4, 45.9]\n GNP real, -- Gross National Product, example: [828.0, 5976.0]\n GNPOld real, -- Gross National Product Old, example: [793.0, 7984.0]\n Capital integer, -- example: [129, 1]\n PRIMARY KEY (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTurkmenistan is a name of country;\nList the languages used in Turkmenistan.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = 'Turkmenistan'", "style": "rule" }
{ "db_id": "world.sqlite", "gt_sql": "SELECT T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = 'Turkmenistan'", "index": 3688, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE City (\n ID integer, -- example: [1, 2]\n Name text, -- example: ['Kabul', 'Qandahar']\n CountryCode text, -- example: ['AFG', 'NLD']\n District text, -- example: ['Kabol', 'Qandahar']\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['ABW', 'AFG']\n `Language` text, -- example: ['Dutch', 'English']\n IsOfficial text, -- example: ['T', 'F']\n Percentage real, -- example: [5.3, 9.5]\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE Country (\n Code text, -- example: ['ABW', 'AFG']\n Name text, -- example: ['Turkmenistan', 'Aruba', 'Afghanistan']\n Region text, -- example: ['Caribbean', 'Southern and Central Asia']\n LifeExpectancy real, -- example: [78.4, 45.9]\n GNP real, -- Gross National Product, example: [828.0, 5976.0]\n GNPOld real, -- Gross National Product Old, example: [793.0, 7984.0]\n Capital integer, -- example: [129, 1]\n PRIMARY KEY (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTurkmenistan is a name of country;\nList the languages used in Turkmenistan.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Country (\n Code text, -- example: ['ABW', 'AFG']\n Name text, -- example: ['Aruba', 'Afghanistan']\n SurfaceArea real, -- example: [193.0, 652090.0]\n Population integer, -- example: [103000, 22720000]\n LifeExpectancy real, -- example: [78.4, 45.9]\n GNP real, -- Gross National Product, example: [828.0, 5976.0]\n GNPOld real, -- Gross National Product Old, example: [793.0, 7984.0]\n LocalName text, -- example: ['Aruba', 'Afganistan/Afqanestan']\n GovernmentForm text, -- example: ['Nonmetropolitan Territory of The Netherl', 'Islamic Emirate']\n Capital integer, -- example: [129, 1]\n Code2 text, -- example: ['AW', 'AF']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['ABW', 'AFG']\n `Language` text, -- example: ['Dutch', 'English']\n IsOfficial text, -- example: ['T', 'F']\n Percentage real, -- example: [5.3, 9.5]\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE City (\n ID integer, -- example: [1, 2]\n Name text, -- example: ['Kabul', 'Qandahar']\n CountryCode text, -- example: ['AFG', 'NLD']\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncapital city refers to Capital; official language refers to IsOfficial = 'T'; highest life expectancy refers to MAX(LifeExpectancy);\nProvide the name, capital city and its official language of the country with the highest life expectancy.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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, T1.Capital, T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode INNER JOIN City AS T3 ON T1.Code = T3.CountryCode WHERE T2.IsOfficial = 'T' ORDER BY T1.LifeExpectancy DESC LIMIT 1", "style": "rule" }
{ "db_id": "world.sqlite", "gt_sql": "SELECT T1.Name, T1.Capital, T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode INNER JOIN City AS T3 ON T1.Code = T3.CountryCode WHERE T2.IsOfficial = 'T' ORDER BY T1.LifeExpectancy DESC LIMIT 1", "index": 3689, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Country (\n Code text, -- example: ['ABW', 'AFG']\n Name text, -- example: ['Aruba', 'Afghanistan']\n SurfaceArea real, -- example: [193.0, 652090.0]\n Population integer, -- example: [103000, 22720000]\n LifeExpectancy real, -- example: [78.4, 45.9]\n GNP real, -- Gross National Product, example: [828.0, 5976.0]\n GNPOld real, -- Gross National Product Old, example: [793.0, 7984.0]\n LocalName text, -- example: ['Aruba', 'Afganistan/Afqanestan']\n GovernmentForm text, -- example: ['Nonmetropolitan Territory of The Netherl', 'Islamic Emirate']\n Capital integer, -- example: [129, 1]\n Code2 text, -- example: ['AW', 'AF']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['ABW', 'AFG']\n `Language` text, -- example: ['Dutch', 'English']\n IsOfficial text, -- example: ['T', 'F']\n Percentage real, -- example: [5.3, 9.5]\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE City (\n ID integer, -- example: [1, 2]\n Name text, -- example: ['Kabul', 'Qandahar']\n CountryCode text, -- example: ['AFG', 'NLD']\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncapital city refers to Capital; official language refers to IsOfficial = 'T'; highest life expectancy refers to MAX(LifeExpectancy);\nProvide the name, capital city and its official language of the country with the highest life expectancy.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Country (\n Code text, -- example: ['ABW', 'AFG']\n Name text, -- example: ['Aruba', 'Afghanistan']\n Continent text, -- example: ['North America', 'Asia']\n Region text, -- example: ['Baltic Countries', 'Caribbean', 'Southern and Central Asia']\n SurfaceArea real, -- example: [193.0, 652090.0]\n IndepYear integer, -- Independence Year, example: [1919, 1975]\n Population integer, -- example: [103000, 22720000]\n LifeExpectancy real, -- example: [78.4, 45.9]\n GNPOld real, -- Gross National Product Old, example: [793.0, 7984.0]\n LocalName text, -- example: ['Aruba', 'Afganistan/Afqanestan']\n GovernmentForm text, -- example: ['Nonmetropolitan Territory of The Netherl', 'Islamic Emirate']\n HeadOfState text, -- example: ['Beatrix', 'Mohammad Omar']\n Capital integer, -- example: [129, 1]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['ABW', 'AFG']\n `Language` text, -- example: ['Dutch', 'English']\n Percentage real, -- example: [5.3, 9.5]\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE City (\n ID integer, -- example: [1, 2]\n Name text, -- example: ['Kabul', 'Qandahar']\n CountryCode text, -- example: ['AFG', 'NLD']\n District text, -- example: ['Kabol', 'Qandahar']\n Population integer, -- example: [1780000, 237500]\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBaltic Countries refers to Region = 'Baltic Countries'; languages which are used by over 80% refers to Percentage > 80;\nAmong the languages used in Baltic Countries, provide the languages which are used by over 80%.\n\n\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Region = 'Baltic Countries' AND T2.Percentage > 80", "style": "rule" }
{ "db_id": "world.sqlite", "gt_sql": "SELECT T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Region = 'Baltic Countries' AND T2.Percentage > 80", "index": 3690, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Country (\n Code text, -- example: ['ABW', 'AFG']\n Name text, -- example: ['Aruba', 'Afghanistan']\n Continent text, -- example: ['North America', 'Asia']\n Region text, -- example: ['Baltic Countries', 'Caribbean', 'Southern and Central Asia']\n SurfaceArea real, -- example: [193.0, 652090.0]\n IndepYear integer, -- Independence Year, example: [1919, 1975]\n Population integer, -- example: [103000, 22720000]\n LifeExpectancy real, -- example: [78.4, 45.9]\n GNPOld real, -- Gross National Product Old, example: [793.0, 7984.0]\n LocalName text, -- example: ['Aruba', 'Afganistan/Afqanestan']\n GovernmentForm text, -- example: ['Nonmetropolitan Territory of The Netherl', 'Islamic Emirate']\n HeadOfState text, -- example: ['Beatrix', 'Mohammad Omar']\n Capital integer, -- example: [129, 1]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['ABW', 'AFG']\n `Language` text, -- example: ['Dutch', 'English']\n Percentage real, -- example: [5.3, 9.5]\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE City (\n ID integer, -- example: [1, 2]\n Name text, -- example: ['Kabul', 'Qandahar']\n CountryCode text, -- example: ['AFG', 'NLD']\n District text, -- example: ['Kabol', 'Qandahar']\n Population integer, -- example: [1780000, 237500]\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBaltic Countries refers to Region = 'Baltic Countries'; languages which are used by over 80% refers to Percentage > 80;\nAmong the languages used in Baltic Countries, provide the languages which are used by over 80%.\n\n\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE City (\n ID integer, -- example: [1, 2]\n Name text, -- example: ['Kabul', 'Qandahar']\n CountryCode text, -- example: ['AFG', 'NLD']\n Population integer, -- example: [1780000, 237500]\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE Country (\n Code text, -- example: ['ABW', 'AFG']\n Name text, -- example: ['Aruba', 'Afghanistan']\n Region text, -- example: ['Caribbean', 'Southern and Central Asia']\n SurfaceArea real, -- example: [193.0, 652090.0]\n IndepYear integer, -- Independence Year, example: [1919, 1975]\n Population integer, -- example: [103000, 22720000]\n LifeExpectancy real, -- example: [78.4, 45.9]\n GNP real, -- Gross National Product, example: [828.0, 5976.0]\n GNPOld real, -- Gross National Product Old, example: [793.0, 7984.0]\n LocalName text, -- example: ['Aruba', 'Afganistan/Afqanestan']\n GovernmentForm text, -- example: ['Nonmetropolitan Territory of The Netherl', 'Islamic Emirate']\n HeadOfState text, -- example: ['Beatrix', 'Mohammad Omar']\n Capital integer, -- example: [129, 1]\n Code2 text, -- example: ['US', 'AW', 'AF']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['ABW', 'AFG']\n `Language` text, -- example: ['Min', 'Dutch', 'English']\n IsOfficial text, -- example: ['T', 'F']\n Percentage real, -- example: [5.3, 9.5]\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncapital city refers to Capital; shortest life expectancy refers to MIN(LifeExpectancy);\nDescribe the capital city and languages used in the country with the shortest life expectancy.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Capital, T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode INNER JOIN City AS T3 ON T1.Code = T3.CountryCode ORDER BY T1.LifeExpectancy LIMIT 1", "style": "rule" }
{ "db_id": "world.sqlite", "gt_sql": "SELECT T1.Capital, T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode INNER JOIN City AS T3 ON T1.Code = T3.CountryCode ORDER BY T1.LifeExpectancy LIMIT 1", "index": 3691, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE City (\n ID integer, -- example: [1, 2]\n Name text, -- example: ['Kabul', 'Qandahar']\n CountryCode text, -- example: ['AFG', 'NLD']\n Population integer, -- example: [1780000, 237500]\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE Country (\n Code text, -- example: ['ABW', 'AFG']\n Name text, -- example: ['Aruba', 'Afghanistan']\n Region text, -- example: ['Caribbean', 'Southern and Central Asia']\n SurfaceArea real, -- example: [193.0, 652090.0]\n IndepYear integer, -- Independence Year, example: [1919, 1975]\n Population integer, -- example: [103000, 22720000]\n LifeExpectancy real, -- example: [78.4, 45.9]\n GNP real, -- Gross National Product, example: [828.0, 5976.0]\n GNPOld real, -- Gross National Product Old, example: [793.0, 7984.0]\n LocalName text, -- example: ['Aruba', 'Afganistan/Afqanestan']\n GovernmentForm text, -- example: ['Nonmetropolitan Territory of The Netherl', 'Islamic Emirate']\n HeadOfState text, -- example: ['Beatrix', 'Mohammad Omar']\n Capital integer, -- example: [129, 1]\n Code2 text, -- example: ['US', 'AW', 'AF']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['ABW', 'AFG']\n `Language` text, -- example: ['Min', 'Dutch', 'English']\n IsOfficial text, -- example: ['T', 'F']\n Percentage real, -- example: [5.3, 9.5]\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncapital city refers to Capital; shortest life expectancy refers to MIN(LifeExpectancy);\nDescribe the capital city and languages used in the country with the shortest life expectancy.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Country (\n Code text, -- example: ['ABW', 'AFG']\n Name text, -- example: ['Aruba', 'Afghanistan']\n Continent text, -- example: ['North America', 'Asia']\n Region text, -- example: ['Caribbean', 'Southern and Central Asia']\n SurfaceArea real, -- example: [193.0, 652090.0]\n IndepYear integer, -- Independence Year, example: [1919, 1975]\n Population integer, -- example: [103000, 22720000]\n LifeExpectancy real, -- example: [78.4, 45.9]\n GNP real, -- Gross National Product, example: [828.0, 5976.0]\n GNPOld real, -- Gross National Product Old, example: [793.0, 7984.0]\n LocalName text, -- example: ['Aruba', 'Afganistan/Afqanestan']\n GovernmentForm text, -- example: ['Nonmetropolitan Territory of The Netherl', 'Islamic Emirate']\n HeadOfState text, -- example: ['Beatrix', 'Mohammad Omar']\n Capital integer, -- example: [129, 1]\n Code2 text, -- example: ['AW', 'AF']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['ABW', 'AFG']\n `Language` text, -- example: ['Min', 'Dutch', 'English']\n IsOfficial text, -- example: ['T', 'F']\n Percentage real, -- example: [5.3, 9.5]\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE City (\n ID integer, -- example: [1, 2]\n Name text, -- example: ['Kabul', 'Qandahar']\n CountryCode text, -- example: ['AFG', 'NLD']\n District text, -- example: ['Kabol', 'Qandahar']\n Population integer, -- example: [1780000, 237500]\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncapital city refers to Capital; official language refers to IsOfficial = 'T'; smallest surface area refers to MIN(SurfaceArea);\nProvide the country, population, capital city, and official language of the country with the smallest surface area.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Name, T1.Population, T1.Capital, T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode INNER JOIN City AS T3 ON T1.Code = T3.CountryCode WHERE T2.IsOfficial = 'T' ORDER BY T1.SurfaceArea LIMIT 1", "style": "rule" }
{ "db_id": "world.sqlite", "gt_sql": "SELECT T1.Name, T1.Population, T1.Capital, T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode INNER JOIN City AS T3 ON T1.Code = T3.CountryCode WHERE T2.IsOfficial = 'T' ORDER BY T1.SurfaceArea LIMIT 1", "index": 3692, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Country (\n Code text, -- example: ['ABW', 'AFG']\n Name text, -- example: ['Aruba', 'Afghanistan']\n Continent text, -- example: ['North America', 'Asia']\n Region text, -- example: ['Caribbean', 'Southern and Central Asia']\n SurfaceArea real, -- example: [193.0, 652090.0]\n IndepYear integer, -- Independence Year, example: [1919, 1975]\n Population integer, -- example: [103000, 22720000]\n LifeExpectancy real, -- example: [78.4, 45.9]\n GNP real, -- Gross National Product, example: [828.0, 5976.0]\n GNPOld real, -- Gross National Product Old, example: [793.0, 7984.0]\n LocalName text, -- example: ['Aruba', 'Afganistan/Afqanestan']\n GovernmentForm text, -- example: ['Nonmetropolitan Territory of The Netherl', 'Islamic Emirate']\n HeadOfState text, -- example: ['Beatrix', 'Mohammad Omar']\n Capital integer, -- example: [129, 1]\n Code2 text, -- example: ['AW', 'AF']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['ABW', 'AFG']\n `Language` text, -- example: ['Min', 'Dutch', 'English']\n IsOfficial text, -- example: ['T', 'F']\n Percentage real, -- example: [5.3, 9.5]\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE City (\n ID integer, -- example: [1, 2]\n Name text, -- example: ['Kabul', 'Qandahar']\n CountryCode text, -- example: ['AFG', 'NLD']\n District text, -- example: ['Kabol', 'Qandahar']\n Population integer, -- example: [1780000, 237500]\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncapital city refers to Capital; official language refers to IsOfficial = 'T'; smallest surface area refers to MIN(SurfaceArea);\nProvide the country, population, capital city, and official language of the country with the smallest surface area.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['ABW', 'AFG']\n `Language` text, -- example: ['English', 'Dutch']\n Percentage real, -- example: [5.3, 9.5]\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE City (\n ID integer, -- example: [1, 2]\n CountryCode text, -- example: ['AFG', 'NLD']\n Population integer, -- example: [1780000, 237500]\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE Country (\n Code text, -- example: ['ABW', 'AFG']\n Continent text, -- example: ['North America', 'Asia']\n SurfaceArea real, -- example: [193.0, 652090.0]\n IndepYear integer, -- Independence Year, example: [1919, 1975]\n GNPOld real, -- Gross National Product Old, example: [793.0, 7984.0]\n HeadOfState text, -- example: ['Beatrix', 'Mohammad Omar']\n PRIMARY KEY (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage = MULTIPLY(DIVIDE(COUNT(Language = 'English' WHERE Continent = 'North America'), COUNT(Language WHERE Continent = 'North America')), 1.0); North America refers to Continent = 'North America'; use English refers to Language = 'English';\nHow many percent of countries in North America use English?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Language = 'English', 1, 0)) AS REAL) * 100 / COUNT(T1.Code) FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode", "style": "rule" }
{ "db_id": "world.sqlite", "gt_sql": "SELECT CAST(SUM(IIF(T2.Language = 'English', 1, 0)) AS REAL) * 100 / COUNT(T1.Code) FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode", "index": 3693, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['ABW', 'AFG']\n `Language` text, -- example: ['English', 'Dutch']\n Percentage real, -- example: [5.3, 9.5]\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE City (\n ID integer, -- example: [1, 2]\n CountryCode text, -- example: ['AFG', 'NLD']\n Population integer, -- example: [1780000, 237500]\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE Country (\n Code text, -- example: ['ABW', 'AFG']\n Continent text, -- example: ['North America', 'Asia']\n SurfaceArea real, -- example: [193.0, 652090.0]\n IndepYear integer, -- Independence Year, example: [1919, 1975]\n GNPOld real, -- Gross National Product Old, example: [793.0, 7984.0]\n HeadOfState text, -- example: ['Beatrix', 'Mohammad Omar']\n PRIMARY KEY (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage = MULTIPLY(DIVIDE(COUNT(Language = 'English' WHERE Continent = 'North America'), COUNT(Language WHERE Continent = 'North America')), 1.0); North America refers to Continent = 'North America'; use English refers to Language = 'English';\nHow many percent of countries in North America use English?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['ABW', 'AFG']\n `Language` text, -- example: ['English', 'Ha', 'Dutch']\n IsOfficial text, -- example: ['T', 'F']\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE Country (\n Code text, -- example: ['ABW', 'AFG']\n Name text, -- example: ['Aruba', 'Afghanistan']\n SurfaceArea real, -- example: [193.0, 652090.0]\n Population integer, -- example: [103000, 22720000]\n GNP real, -- Gross National Product, example: [828.0, 5976.0]\n GNPOld real, -- Gross National Product Old, example: [793.0, 7984.0]\n HeadOfState text, -- example: ['Beatrix', 'Mohammad Omar']\n Capital integer, -- example: [129, 1]\n Code2 text, -- example: ['US', 'AW', 'AF']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE City (\n ID integer, -- example: [1, 2]\n Name text, -- example: ['Kabul', 'Qandahar']\n CountryCode text, -- example: ['AFG', 'NLD']\n Population integer, -- example: [1780000, 237500]\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nofficially use the English language refers to `Language` = 'English' AND IsOfficial = 'T'; highest capital refers to MAX(Capital);\nAmong the countries that officially use the English language, what country has the highest capital?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Code FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'English' AND T2.IsOfficial = 'T' ORDER BY T1.Capital DESC LIMIT 1", "style": "rule" }
{ "db_id": "world.sqlite", "gt_sql": "SELECT T1.Code FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'English' AND T2.IsOfficial = 'T' ORDER BY T1.Capital DESC LIMIT 1", "index": 3694, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['ABW', 'AFG']\n `Language` text, -- example: ['English', 'Ha', 'Dutch']\n IsOfficial text, -- example: ['T', 'F']\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE Country (\n Code text, -- example: ['ABW', 'AFG']\n Name text, -- example: ['Aruba', 'Afghanistan']\n SurfaceArea real, -- example: [193.0, 652090.0]\n Population integer, -- example: [103000, 22720000]\n GNP real, -- Gross National Product, example: [828.0, 5976.0]\n GNPOld real, -- Gross National Product Old, example: [793.0, 7984.0]\n HeadOfState text, -- example: ['Beatrix', 'Mohammad Omar']\n Capital integer, -- example: [129, 1]\n Code2 text, -- example: ['US', 'AW', 'AF']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE City (\n ID integer, -- example: [1, 2]\n Name text, -- example: ['Kabul', 'Qandahar']\n CountryCode text, -- example: ['AFG', 'NLD']\n Population integer, -- example: [1780000, 237500]\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nofficially use the English language refers to `Language` = 'English' AND IsOfficial = 'T'; highest capital refers to MAX(Capital);\nAmong the countries that officially use the English language, what country has the highest capital?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Country (\n Code text, -- example: ['ABW', 'AFG']\n Name text, -- example: ['Aruba', 'Afghanistan']\n Continent text, -- example: ['North America', 'Asia']\n Region text, -- example: ['Caribbean', 'Southern and Central Asia']\n SurfaceArea real, -- example: [193.0, 652090.0]\n IndepYear integer, -- Independence Year, example: [1919, 1975]\n LifeExpectancy real, -- example: [78.4, 45.9]\n GNP real, -- Gross National Product, example: [828.0, 5976.0]\n GNPOld real, -- Gross National Product Old, example: [793.0, 7984.0]\n LocalName text, -- example: ['Aruba', 'Afganistan/Afqanestan']\n GovernmentForm text, -- example: ['Nonmetropolitan Territory of The Netherl', 'Islamic Emirate']\n Code2 text, -- example: ['AW', 'AF']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['ABW', 'AFG']\n `Language` text, -- example: ['Dutch', 'English']\n Percentage real, -- example: [5.3, 9.5]\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE City (\n ID integer, -- example: [1, 2]\n Name text, -- example: ['Sutton Coldfield', 'Kabul', 'Qandahar']\n CountryCode text, -- example: ['AFG', 'NLD']\n Population integer, -- example: [1780000, 237500]\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the surface area of the country where Sutton Coldfield city belongs?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.SurfaceArea FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode WHERE T2.Name = 'Sutton Coldfield'", "style": "rule" }
{ "db_id": "world.sqlite", "gt_sql": "SELECT T1.SurfaceArea FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode WHERE T2.Name = 'Sutton Coldfield'", "index": 3695, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Country (\n Code text, -- example: ['ABW', 'AFG']\n Name text, -- example: ['Aruba', 'Afghanistan']\n Continent text, -- example: ['North America', 'Asia']\n Region text, -- example: ['Caribbean', 'Southern and Central Asia']\n SurfaceArea real, -- example: [193.0, 652090.0]\n IndepYear integer, -- Independence Year, example: [1919, 1975]\n LifeExpectancy real, -- example: [78.4, 45.9]\n GNP real, -- Gross National Product, example: [828.0, 5976.0]\n GNPOld real, -- Gross National Product Old, example: [793.0, 7984.0]\n LocalName text, -- example: ['Aruba', 'Afganistan/Afqanestan']\n GovernmentForm text, -- example: ['Nonmetropolitan Territory of The Netherl', 'Islamic Emirate']\n Code2 text, -- example: ['AW', 'AF']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['ABW', 'AFG']\n `Language` text, -- example: ['Dutch', 'English']\n Percentage real, -- example: [5.3, 9.5]\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE City (\n ID integer, -- example: [1, 2]\n Name text, -- example: ['Sutton Coldfield', 'Kabul', 'Qandahar']\n CountryCode text, -- example: ['AFG', 'NLD']\n Population integer, -- example: [1780000, 237500]\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the surface area of the country where Sutton Coldfield city belongs?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['ABW', 'AFG']\n `Language` text, -- example: ['Dutch', 'English']\n IsOfficial text, -- example: ['T', 'F']\n Percentage real, -- example: [5.3, 9.5]\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE Country (\n Code text, -- example: ['ABW', 'AFG']\n Name text, -- example: ['Cyprus', 'Aruba', 'Afghanistan']\n Continent text, -- example: ['North America', 'Asia']\n Region text, -- example: ['Caribbean', 'Southern and Central Asia']\n LifeExpectancy real, -- example: [78.4, 45.9]\n GNP real, -- Gross National Product, example: [828.0, 5976.0]\n HeadOfState text, -- example: ['Beatrix', 'Mohammad Omar']\n Capital integer, -- example: [129, 1]\n Code2 text, -- example: ['US', 'AW', 'AF']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE City (\n ID integer, -- example: [1, 2]\n Name text, -- example: ['Kabul', 'Qandahar']\n CountryCode text, -- example: ['AFG', 'NLD']\n District text, -- example: ['Kabol', 'Qandahar']\n Population integer, -- example: [1780000, 237500]\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCyprus is a name of Country;\nHow many languages are used in Cyprus?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(CASE WHEN T1.Name = 'Cyprus' THEN 1 ELSE 0 END) FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode", "style": "rule" }
{ "db_id": "world.sqlite", "gt_sql": "SELECT SUM(CASE WHEN T1.Name = 'Cyprus' THEN 1 ELSE 0 END) FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode", "index": 3696, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['ABW', 'AFG']\n `Language` text, -- example: ['Dutch', 'English']\n IsOfficial text, -- example: ['T', 'F']\n Percentage real, -- example: [5.3, 9.5]\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE Country (\n Code text, -- example: ['ABW', 'AFG']\n Name text, -- example: ['Cyprus', 'Aruba', 'Afghanistan']\n Continent text, -- example: ['North America', 'Asia']\n Region text, -- example: ['Caribbean', 'Southern and Central Asia']\n LifeExpectancy real, -- example: [78.4, 45.9]\n GNP real, -- Gross National Product, example: [828.0, 5976.0]\n HeadOfState text, -- example: ['Beatrix', 'Mohammad Omar']\n Capital integer, -- example: [129, 1]\n Code2 text, -- example: ['US', 'AW', 'AF']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE City (\n ID integer, -- example: [1, 2]\n Name text, -- example: ['Kabul', 'Qandahar']\n CountryCode text, -- example: ['AFG', 'NLD']\n District text, -- example: ['Kabol', 'Qandahar']\n Population integer, -- example: [1780000, 237500]\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCyprus is a name of Country;\nHow many languages are used in Cyprus?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['ABW', 'AFG']\n `Language` text, -- example: ['Dutch', 'English']\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE City (\n ID integer, -- example: [1, 2]\n Name text, -- example: ['Kabul', 'Qandahar']\n CountryCode text, -- example: ['AFG', 'NLD']\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE Country (\n Code text, -- example: ['ABW', 'AFG']\n Name text, -- example: ['Aruba', 'Afghanistan']\n Continent text, -- example: ['Asia', 'North America']\n SurfaceArea real, -- example: [193.0, 652090.0]\n IndepYear integer, -- Independence Year, example: [1919, 1975]\n LifeExpectancy real, -- example: [78.4, 45.9]\n GNP real, -- Gross National Product, example: [828.0, 5976.0]\n GNPOld real, -- Gross National Product Old, example: [793.0, 7984.0]\n HeadOfState text, -- example: ['Beatrix', 'Mohammad Omar']\n PRIMARY KEY (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAsia refers to Continent = 'Asia';\nList all the countries in Asia.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Country WHERE Continent = 'Asia'", "style": "rule" }
{ "db_id": "world.sqlite", "gt_sql": "SELECT Name FROM Country WHERE Continent = 'Asia'", "index": 3697, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['ABW', 'AFG']\n `Language` text, -- example: ['Dutch', 'English']\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE City (\n ID integer, -- example: [1, 2]\n Name text, -- example: ['Kabul', 'Qandahar']\n CountryCode text, -- example: ['AFG', 'NLD']\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE Country (\n Code text, -- example: ['ABW', 'AFG']\n Name text, -- example: ['Aruba', 'Afghanistan']\n Continent text, -- example: ['Asia', 'North America']\n SurfaceArea real, -- example: [193.0, 652090.0]\n IndepYear integer, -- Independence Year, example: [1919, 1975]\n LifeExpectancy real, -- example: [78.4, 45.9]\n GNP real, -- Gross National Product, example: [828.0, 5976.0]\n GNPOld real, -- Gross National Product Old, example: [793.0, 7984.0]\n HeadOfState text, -- example: ['Beatrix', 'Mohammad Omar']\n PRIMARY KEY (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAsia refers to Continent = 'Asia';\nList all the countries in Asia.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Country (\n Code text, -- example: ['PHL', 'ABW', 'AFG']\n Name text, -- example: ['Philippines', 'Aruba', 'Afghanistan']\n Continent text, -- example: ['North America', 'Asia']\n Region text, -- example: ['Caribbean', 'Southern and Central Asia']\n SurfaceArea real, -- example: [193.0, 652090.0]\n IndepYear integer, -- Independence Year, example: [1919, 1975]\n Population integer, -- example: [103000, 22720000]\n LifeExpectancy real, -- example: [78.4, 45.9]\n GNPOld real, -- Gross National Product Old, example: [793.0, 7984.0]\n LocalName text, -- example: ['Aruba', 'Afganistan/Afqanestan']\n GovernmentForm text, -- example: ['Nonmetropolitan Territory of The Netherl', 'Islamic Emirate']\n HeadOfState text, -- example: ['Beatrix', 'Mohammad Omar']\n Capital integer, -- example: [129, 1]\n Code2 text, -- example: ['AW', 'AF']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE City (\n ID integer, -- example: [1, 2]\n Name text, -- example: ['Kabul', 'Qandahar']\n CountryCode text, -- example: ['PHL', 'AFG', 'NLD']\n District text, -- example: ['Kabol', 'Qandahar']\n Population integer, -- example: [1780000, 237500]\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['PHL', 'ABW', 'AFG']\n `Language` text, -- example: ['Dutch', 'English']\n IsOfficial text, -- example: ['T', 'F']\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPhilippines refers to CountryCode = 'PHL';\nHow many cities are in the Philippines?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(ID) FROM City WHERE Name = 'PHL'", "style": "rule" }
{ "db_id": "world.sqlite", "gt_sql": "SELECT COUNT(ID) FROM City WHERE Name = 'PHL'", "index": 3698, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Country (\n Code text, -- example: ['PHL', 'ABW', 'AFG']\n Name text, -- example: ['Philippines', 'Aruba', 'Afghanistan']\n Continent text, -- example: ['North America', 'Asia']\n Region text, -- example: ['Caribbean', 'Southern and Central Asia']\n SurfaceArea real, -- example: [193.0, 652090.0]\n IndepYear integer, -- Independence Year, example: [1919, 1975]\n Population integer, -- example: [103000, 22720000]\n LifeExpectancy real, -- example: [78.4, 45.9]\n GNPOld real, -- Gross National Product Old, example: [793.0, 7984.0]\n LocalName text, -- example: ['Aruba', 'Afganistan/Afqanestan']\n GovernmentForm text, -- example: ['Nonmetropolitan Territory of The Netherl', 'Islamic Emirate']\n HeadOfState text, -- example: ['Beatrix', 'Mohammad Omar']\n Capital integer, -- example: [129, 1]\n Code2 text, -- example: ['AW', 'AF']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE City (\n ID integer, -- example: [1, 2]\n Name text, -- example: ['Kabul', 'Qandahar']\n CountryCode text, -- example: ['PHL', 'AFG', 'NLD']\n District text, -- example: ['Kabol', 'Qandahar']\n Population integer, -- example: [1780000, 237500]\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['PHL', 'ABW', 'AFG']\n `Language` text, -- example: ['Dutch', 'English']\n IsOfficial text, -- example: ['T', 'F']\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPhilippines refers to CountryCode = 'PHL';\nHow many cities are in the Philippines?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['ABW', 'AFG']\n `Language` text, -- example: ['Ha', 'Dutch', 'English']\n IsOfficial text, -- example: ['T', 'F']\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE Country (\n Code text, -- example: ['ABW', 'AFG']\n Name text, -- example: ['Aruba', 'Afghanistan']\n Continent text, -- example: ['North America', 'Asia']\n Region text, -- example: ['Caribbean', 'Southern and Central Asia']\n SurfaceArea real, -- example: [193.0, 652090.0]\n Population integer, -- example: [103000, 22720000]\n LifeExpectancy real, -- example: [78.4, 45.9]\n GNP real, -- Gross National Product, example: [828.0, 5976.0]\n LocalName text, -- example: ['Aruba', 'Afganistan/Afqanestan']\n GovernmentForm text, -- example: ['Nonmetropolitan Territory of The Netherl', 'Islamic Emirate']\n HeadOfState text, -- example: ['Beatrix', 'Mohammad Omar']\n Code2 text, -- example: ['AW', 'AF']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE City (\n ID integer, -- example: [1, 2]\n Name text, -- example: ['Manila', 'Kabul', 'Qandahar']\n CountryCode text, -- example: ['AFG', 'NLD']\n Population integer, -- example: [1780000, 237500]\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nform of government refers to GovernmentForm;\nWhat is the form of government that the city of Manila has?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.GovernmentForm FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode WHERE T2.Name = 'Manila'", "style": "rule" }
{ "db_id": "world.sqlite", "gt_sql": "SELECT T1.GovernmentForm FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode WHERE T2.Name = 'Manila'", "index": 3699, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryLanguage (\n CountryCode text, -- example: ['ABW', 'AFG']\n `Language` text, -- example: ['Ha', 'Dutch', 'English']\n IsOfficial text, -- example: ['T', 'F']\n PRIMARY KEY (CountryCode, `Language`),\n CONSTRAINT fk_countrylanguage_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\n\nCREATE TABLE Country (\n Code text, -- example: ['ABW', 'AFG']\n Name text, -- example: ['Aruba', 'Afghanistan']\n Continent text, -- example: ['North America', 'Asia']\n Region text, -- example: ['Caribbean', 'Southern and Central Asia']\n SurfaceArea real, -- example: [193.0, 652090.0]\n Population integer, -- example: [103000, 22720000]\n LifeExpectancy real, -- example: [78.4, 45.9]\n GNP real, -- Gross National Product, example: [828.0, 5976.0]\n LocalName text, -- example: ['Aruba', 'Afganistan/Afqanestan']\n GovernmentForm text, -- example: ['Nonmetropolitan Territory of The Netherl', 'Islamic Emirate']\n HeadOfState text, -- example: ['Beatrix', 'Mohammad Omar']\n Code2 text, -- example: ['AW', 'AF']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE City (\n ID integer, -- example: [1, 2]\n Name text, -- example: ['Manila', 'Kabul', 'Qandahar']\n CountryCode text, -- example: ['AFG', 'NLD']\n Population integer, -- example: [1780000, 237500]\n PRIMARY KEY (ID),\n CONSTRAINT fk_city_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nform of government refers to GovernmentForm;\nWhat is the form of government that the city of Manila has?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }