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 City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of player refers to Player_Name; on 2008/4/18 refers to Match_Date = '2008-04-18'\nWhat is the name of the player who won the \"man of the match\" award in the match on 2008/4/18?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Player_Name FROM Match AS T1 INNER JOIN Player AS T2 ON T2.Player_Id = T1.Man_of_the_Match WHERE T1.Match_Date = '2008-04-18'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T2.Player_Name FROM Match AS T1 INNER JOIN Player AS T2 ON T2.Player_Id = T1.Man_of_the_Match WHERE T1.Match_Date = '2008-04-18'",
"index": 900,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of player refers to Player_Name; on 2008/4/18 refers to Match_Date = '2008-04-18'\nWhat is the name of the player who won the \"man of the match\" award in the match on 2008/4/18?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSC Ganguly refers to Player_Name = 'SC Ganguly'; team captain refers to Role_Desc = 'Captain'\nFor how many times has SC Ganguly played as team captain in a match?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 T3.Role_Desc = 'Captain' THEN 1 ELSE 0 END) FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T1.Player_Id = T2.Player_Id INNER JOIN Rolee AS T3 ON T2.Role_Id = T3.Role_Id WHERE T1.Player_Name = 'SC Ganguly'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T3.Role_Desc = 'Captain' THEN 1 ELSE 0 END) FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T1.Player_Id = T2.Player_Id INNER JOIN Rolee AS T3 ON T2.Role_Id = T3.Role_Id WHERE T1.Player_Name = 'SC Ganguly'",
"index": 901,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSC Ganguly refers to Player_Name = 'SC Ganguly'; team captain refers to Role_Desc = 'Captain'\nFor how many times has SC Ganguly played as team captain in a match?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of player refers to Player_Name; the youngest refers to max(DOB)\nGive the name of the youngest 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 Player_Name FROM Player ORDER BY DOB DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT Player_Name FROM Player ORDER BY DOB DESC LIMIT 1",
"index": 902,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of player refers to Player_Name; the youngest refers to max(DOB)\nGive the name of the youngest 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 Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Sunrisers Hyderabad', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSunrisers Hyderabad refers to Team_Name = 'Sunrisers Hyderabad'; time of toss winner refers to count(Toss_Winner)\nHow many times has Sunrisers Hyderabad been the toss winner of a game?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(CASE WHEN Toss_Winner = ( SELECT Team_Id FROM Team WHERE Team_Name = 'Sunrisers Hyderabad' ) THEN 1 ELSE 0 END) FROM `Match`",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN Toss_Winner = ( SELECT Team_Id FROM Team WHERE Team_Name = 'Sunrisers Hyderabad' ) THEN 1 ELSE 0 END) FROM `Match`",
"index": 903,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Sunrisers Hyderabad', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSunrisers Hyderabad refers to Team_Name = 'Sunrisers Hyderabad'; time of toss winner refers to count(Toss_Winner)\nHow many times has Sunrisers Hyderabad been the toss winner of a game?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to Player_Name; in 2013 refers to Season_Year = 2013\nWho was the man of the series in 2013? 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.Player_Name FROM Season AS T1 INNER JOIN Player AS T2 ON T1.Man_of_the_Series = T2.Player_Id WHERE T1.Season_Year = 2013",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T2.Player_Name FROM Season AS T1 INNER JOIN Player AS T2 ON T1.Man_of_the_Series = T2.Player_Id WHERE T1.Season_Year = 2013",
"index": 904,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to Player_Name; in 2013 refers to Season_Year = 2013\nWho was the man of the series in 2013? 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 Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndate of birth refers to DOB; 2014 refers to Season_Year = 2014; Orange Cap winner refers to Orange_Cap IS NOT NULL\nGive the date of birth of the 2014 Orange Cap winner.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.DOB FROM Season AS T1 INNER JOIN Player AS T2 ON T1.Man_of_the_Series = T2.Player_Id WHERE T1.Season_Year = 2014 AND T1.Orange_Cap IS NOT NULL",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T2.DOB FROM Season AS T1 INNER JOIN Player AS T2 ON T1.Man_of_the_Series = T2.Player_Id WHERE T1.Season_Year = 2014 AND T1.Orange_Cap IS NOT NULL",
"index": 905,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndate of birth refers to DOB; 2014 refers to Season_Year = 2014; Orange Cap winner refers to Orange_Cap IS NOT NULL\nGive the date of birth of the 2014 Orange Cap winner.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['bat', 'field']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['MK Pandey', 'SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMK Pandey refers to Player_Name = 'MK Pandey'\nWhat is the batting hand of MK Pandey?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Batting_hand FROM Player AS T1 INNER JOIN Batting_Style AS T2 ON T1.Batting_hand = T2.Batting_Id WHERE T1.Player_Name = 'MK Pandey'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T2.Batting_hand FROM Player AS T1 INNER JOIN Batting_Style AS T2 ON T1.Batting_hand = T2.Batting_Id WHERE T1.Player_Name = 'MK Pandey'",
"index": 906,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['bat', 'field']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['MK Pandey', 'SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMK Pandey refers to Player_Name = 'MK Pandey'\nWhat is the batting hand of MK Pandey?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['South Africa', 'India']\n PRIMARY KEY (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIndian refers to Country_Name = 'India'; South African refers to Country_Name = 'South Africa'; how many times = divide(count(City_Id where Country_Name = 'India'), count(City_Id where Country_Name = 'South Africa'))\nIn the database, how many times is the number of Indian cities to the South African cities?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T2.Country_Name = 'India' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T2.Country_Name = 'South Africa' THEN 1 ELSE 0 END) FROM City AS T1 INNER JOIN Country AS T2 ON T1.Country_Id = T2.Country_Id",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T2.Country_Name = 'India' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T2.Country_Name = 'South Africa' THEN 1 ELSE 0 END) FROM City AS T1 INNER JOIN Country AS T2 ON T1.Country_Id = T2.Country_Id",
"index": 907,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['South Africa', 'India']\n PRIMARY KEY (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIndian refers to Country_Name = 'India'; South African refers to Country_Name = 'South Africa'; how many times = divide(count(City_Id where Country_Name = 'India'), count(City_Id where Country_Name = 'South Africa'))\nIn the database, how many times is the number of Indian cities to the South African cities?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the player refers to Player_Name; the oldest refers to min(DOB)\nWho is the oldest 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 Player_Name FROM Player ORDER BY DOB ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT Player_Name FROM Player ORDER BY DOB ASC LIMIT 1",
"index": 908,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the player refers to Player_Name; the oldest refers to min(DOB)\nWho is the oldest 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 Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin May 2008 refers to SUBSTR(Match_Date, 1, 4) = '2008' AND SUBSTR(Match_Date, 7, 1) = '5'\nHow many matches were played on May 2008?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 SUBSTR(Match_Date, 7, 1) = '5' THEN 1 ELSE 0 END) FROM `Match` WHERE SUBSTR(Match_Date, 1, 4) = '2008'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN SUBSTR(Match_Date, 7, 1) = '5' THEN 1 ELSE 0 END) FROM `Match` WHERE SUBSTR(Match_Date, 1, 4) = '2008'",
"index": 909,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin May 2008 refers to SUBSTR(Match_Date, 1, 4) = '2008' AND SUBSTR(Match_Date, 7, 1) = '5'\nHow many matches were played on May 2008?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Striker integer, -- example: [1, 6]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nseason refers to Season_Id; the highest number of matches refers to max(count(Season_Id)); M Chinnaswamy Stadium refers to Venue_Name = 'M Chinnaswamy Stadium'\nWhich season played the highest number of matches at M Chinnaswamy Stadium?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Season_Id FROM `Match` AS T1 INNER JOIN Venue AS T2 ON T1.Venue_Id = T2.Venue_Id WHERE T2.Venue_Name = 'M Chinnaswamy Stadium' GROUP BY T1.Season_Id ORDER BY COUNT(T1.Season_Id) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T1.Season_Id FROM `Match` AS T1 INNER JOIN Venue AS T2 ON T1.Venue_Id = T2.Venue_Id WHERE T2.Venue_Name = 'M Chinnaswamy Stadium' GROUP BY T1.Season_Id ORDER BY COUNT(T1.Season_Id) DESC LIMIT 1",
"index": 910,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Striker integer, -- example: [1, 6]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nseason refers to Season_Id; the highest number of matches refers to max(count(Season_Id)); M Chinnaswamy Stadium refers to Venue_Name = 'M Chinnaswamy Stadium'\nWhich season played the highest number of matches at M Chinnaswamy Stadium?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the team refers to Team_Name; the most number of matches refers to max(count(Match_Winner)); season 1 refers to season_Id = 1\nWhat is the name of the team that won the most number of matches in season 1?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT Team_Name FROM Team WHERE Team_Id = ( SELECT Match_Winner FROM `Match` WHERE season_Id = 1 GROUP BY Match_Winner ORDER BY COUNT(Match_Winner) DESC LIMIT 1 )",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT Team_Name FROM Team WHERE Team_Id = ( SELECT Match_Winner FROM `Match` WHERE season_Id = 1 GROUP BY Match_Winner ORDER BY COUNT(Match_Winner) DESC LIMIT 1 )",
"index": 911,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the team refers to Team_Name; the most number of matches refers to max(count(Match_Winner)); season 1 refers to season_Id = 1\nWhat is the name of the team that won the most number of matches in season 1?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Kolkata', 'Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nvenue refers to Venue_Name; Kolkata Knight Riders refers to Team_Name = 'Kolkata Knight Riders'; most of their matches refers to max(count(Venue_Id)); Team 1 refers to Team_Id = Team_1\nWhich venue did Kolkata Knight Riders play most of their matches as a Team 1?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.Venue_Name FROM Team AS T1 INNER JOIN Match AS T2 ON T1.Team_Id = T2.Team_1 INNER JOIN Venue AS T3 ON T2.Venue_Id = T3.Venue_Id WHERE T1.Team_Name = 'Kolkata Knight Riders' GROUP BY T3.Venue_Id ORDER BY COUNT(T3.Venue_Id) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T3.Venue_Name FROM Team AS T1 INNER JOIN Match AS T2 ON T1.Team_Id = T2.Team_1 INNER JOIN Venue AS T3 ON T2.Venue_Id = T3.Venue_Id WHERE T1.Team_Name = 'Kolkata Knight Riders' GROUP BY T3.Venue_Id ORDER BY COUNT(T3.Venue_Id) DESC LIMIT 1",
"index": 912,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Kolkata', 'Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nvenue refers to Venue_Name; Kolkata Knight Riders refers to Team_Name = 'Kolkata Knight Riders'; most of their matches refers to max(count(Venue_Id)); Team 1 refers to Team_Id = Team_1\nWhich venue did Kolkata Knight Riders play most of their matches as a Team 1?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the team refers to Team_Name; the highest number of losses refers to max(add(count(Team_1 where Team_Id = Team_1 and Team_1 <> Match_Winner), count(Team_2 where Team_Id = Team_2 and Team_2 <> Match_Winner)))\nWhich team has the highest number of losses of all time?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.Team_Name FROM Team AS T1 INNER JOIN ( SELECT COUNT(Team_1) AS a, Team_1 FROM Match WHERE Team_1 <> Match_Winner GROUP BY Team_1 UNION SELECT COUNT(Team_2) AS a, Team_2 FROM Match WHERE Team_2 <> Match_Winner GROUP BY Team_2 ORDER BY a DESC LIMIT 1 ) AS T2 ON T1.Team_Id = T2.Team_1",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T1.Team_Name FROM Team AS T1 INNER JOIN ( SELECT COUNT(Team_1) AS a, Team_1 FROM Match WHERE Team_1 <> Match_Winner GROUP BY Team_1 UNION SELECT COUNT(Team_2) AS a, Team_2 FROM Match WHERE Team_2 <> Match_Winner GROUP BY Team_2 ORDER BY a DESC LIMIT 1 ) AS T2 ON T1.Team_Id = T2.Team_1",
"index": 913,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the team refers to Team_Name; the highest number of losses refers to max(add(count(Team_1 where Team_Id = Team_1 and Team_1 <> Match_Winner), count(Team_2 where Team_Id = Team_2 and Team_2 <> Match_Winner)))\nWhich team has the highest number of losses of all time?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the player refers to Player_Name; the first ever refers to min(match_date); \"man of the match\" award refers to Player_Id in 'Man_of_the_Match'\nWho is the player who won the first ever \"man of the match\" 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 Player_Name FROM Player WHERE Player_Id = ( SELECT Man_of_the_Match FROM `Match` ORDER BY match_date ASC LIMIT 1 )",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT Player_Name FROM Player WHERE Player_Id = ( SELECT Man_of_the_Match FROM `Match` ORDER BY match_date ASC LIMIT 1 )",
"index": 914,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the player refers to Player_Name; the first ever refers to min(match_date); \"man of the match\" award refers to Player_Id in 'Man_of_the_Match'\nWho is the player who won the first ever \"man of the match\" 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 Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Chennai Super Kings', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmatch date refers to Match_Date; Chennai Super Kings refers to Team_Name = 'Chennai Super Kings'; first match refers to min(Match_Date)\nWhen did Chennai Super Kings play its first match?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT Match_Date FROM `Match` WHERE team_1 = ( SELECT Team_Id FROM Team WHERE Team_Name = 'Chennai Super Kings' ) OR Team_2 = ( SELECT Team_Id FROM Team WHERE Team_Name = 'Chennai Super Kings' ) ORDER BY Match_Date ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT Match_Date FROM `Match` WHERE team_1 = ( SELECT Team_Id FROM Team WHERE Team_Name = 'Chennai Super Kings' ) OR Team_2 = ( SELECT Team_Id FROM Team WHERE Team_Name = 'Chennai Super Kings' ) ORDER BY Match_Date ASC LIMIT 1",
"index": 915,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Chennai Super Kings', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmatch date refers to Match_Date; Chennai Super Kings refers to Team_Name = 'Chennai Super Kings'; first match refers to min(Match_Date)\nWhen did Chennai Super Kings play its first match?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['bat', 'field']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nleft-hand batting style refers to Batting_hand = 'Left-hand bat'; India refers to Country_Name = 'India'\nHow many players with left-hand batting style are from India?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Batting_hand = 'Left-hand bat' THEN 1 ELSE 0 END) AS cnt FROM Batting_Style AS T1 INNER JOIN Player AS T2 ON T1.Batting_Id = T2.Batting_hand INNER JOIN Country AS T3 ON T2.Country_Name = T3.Country_Id WHERE T3.Country_Name = 'India'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T1.Batting_hand = 'Left-hand bat' THEN 1 ELSE 0 END) AS cnt FROM Batting_Style AS T1 INNER JOIN Player AS T2 ON T1.Batting_Id = T2.Batting_hand INNER JOIN Country AS T3 ON T2.Country_Name = T3.Country_Id WHERE T3.Country_Name = 'India'",
"index": 916,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['bat', 'field']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nleft-hand batting style refers to Batting_hand = 'Left-hand bat'; India refers to Country_Name = 'India'\nHow many players with left-hand batting style are from India?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Deccan Chargers', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Player', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the player refers to Player_Name; the highest number of roles refers to max(count(Role_Id)); as a captain refers to Role_Desc = 'Captain'; Deccan Chargers refers to Team_Name = 'Deccan Chargers'\nWho is the player that has the highest number of roles as a captain for Deccan Chargers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T4.Player_Name FROM Team AS T1 INNER JOIN Player_Match AS T2 ON T1.Team_id = T2.Team_id INNER JOIN Rolee AS T3 ON T2.Role_Id = T3.Role_Id INNER JOIN Player AS T4 ON T2.Player_Id = T4.Player_Id WHERE T1.Team_Name = 'Deccan Chargers' AND T1.Team_Id = 8 AND T3.Role_Desc = 'Captain' AND T3.Role_Id = 1 GROUP BY T4.Player_Id ORDER BY COUNT(T3.Role_Id) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T4.Player_Name FROM Team AS T1 INNER JOIN Player_Match AS T2 ON T1.Team_id = T2.Team_id INNER JOIN Rolee AS T3 ON T2.Role_Id = T3.Role_Id INNER JOIN Player AS T4 ON T2.Player_Id = T4.Player_Id WHERE T1.Team_Name = 'Deccan Chargers' AND T1.Team_Id = 8 AND T3.Role_Desc = 'Captain' AND T3.Role_Id = 1 GROUP BY T4.Player_Id ORDER BY COUNT(T3.Role_Id) DESC LIMIT 1",
"index": 917,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Deccan Chargers', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Player', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the player refers to Player_Name; the highest number of roles refers to max(count(Role_Id)); as a captain refers to Role_Desc = 'Captain'; Deccan Chargers refers to Team_Name = 'Deccan Chargers'\nWho is the player that has the highest number of roles as a captain for Deccan Chargers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Right-hand bat', 'Left-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nright-handed batting refers to Batting_hand = 'Right-hand bat'; percentage = divide(count(Player_Id where Batting_hand = 'Right-hand bat'), count(Player_Id)) * 100%\nWhat is the percentage of all right-handed batting players among all the other players?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T1.Batting_hand = 'Right-hand bat' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.Player_Id) FROM Batting_Style AS T1 INNER JOIN Player AS T2 ON T2.Batting_hand = T1.Batting_Id",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T1.Batting_hand = 'Right-hand bat' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.Player_Id) FROM Batting_Style AS T1 INNER JOIN Player AS T2 ON T2.Batting_hand = T1.Batting_Id",
"index": 918,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Right-hand bat', 'Left-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nright-handed batting refers to Batting_hand = 'Right-hand bat'; percentage = divide(count(Player_Id where Batting_hand = 'Right-hand bat'), count(Player_Id)) * 100%\nWhat is the percentage of all right-handed batting players among all the other 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 Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1981-07-07', '1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the player refers to Player_Name; born on July 7 1981 refers to DOB = '1981-07-07'\nName the player who is born on July 7, 1981.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT Player_name FROM Player WHERE DOB = '1981-07-07'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT Player_name FROM Player WHERE DOB = '1981-07-07'",
"index": 919,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1981-07-07', '1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the player refers to Player_Name; born on July 7 1981 refers to DOB = '1981-07-07'\nName the player who is born on July 7, 1981.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Mumbai Indians', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Mumbai', 'Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMumbai Indians refers to Team_Name = 'Mumbai Indians'; match ID 335990 refers to Match_Id = 335990\nList the player's name of Mumbai Indians in the match ID 335990.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Team_Name FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T2.Player_Id = T1.Player_Id INNER JOIN Team AS T3 ON T3.Team_Id = T2.Team_Id WHERE T2.Match_Id = 335990 AND T3.Team_Name = 'Mumbai Indians' GROUP BY T3.Team_Name",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T3.Team_Name FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T2.Player_Id = T1.Player_Id INNER JOIN Team AS T3 ON T3.Team_Id = T2.Team_Id WHERE T2.Match_Id = 335990 AND T3.Team_Name = 'Mumbai Indians' GROUP BY T3.Team_Name",
"index": 920,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Mumbai Indians', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Mumbai', 'Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMumbai Indians refers to Team_Name = 'Mumbai Indians'; match ID 335990 refers to Match_Id = 335990\nList the player's name of Mumbai Indians in the match ID 335990.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['U.A.E', 'India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncity refers to City_Name; U.A.E refers to Country_Name = 'U.A.E'\nList the cities located in U.A.E.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.City_Name FROM City AS T1 INNER JOIN Country AS T2 ON T2.Country_Id = T1.Country_id WHERE T2.Country_Name = 'U.A.E'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T1.City_Name FROM City AS T1 INNER JOIN Country AS T2 ON T2.Country_Id = T1.Country_id WHERE T2.Country_Name = 'U.A.E'",
"index": 921,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['U.A.E', 'India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncity refers to City_Name; U.A.E refers to Country_Name = 'U.A.E'\nList the cities located in U.A.E.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2015 refers to Match_Date LIKE '2015%'; the winning team refers to Team_Id = Match_Winner; match ID 829768 refers to Match_Id = 829768\nAmong the matches held in 2015, who is the winning team in the match ID 829768?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Team_Name FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Match_Winner WHERE T1.Match_Date LIKE '2015%' AND T1.Match_Id = 829768",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T2.Team_Name FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Match_Winner WHERE T1.Match_Date LIKE '2015%' AND T1.Match_Id = 829768",
"index": 922,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2015 refers to Match_Date LIKE '2015%'; the winning team refers to Team_Id = Match_Winner; match ID 829768 refers to Match_Id = 829768\nAmong the matches held in 2015, who is the winning team in the match ID 829768?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['South Africa', 'India']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSouth Africa refers to Country_Name = 'South Africa'\nHow many cities are located in South Africa?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(CASE WHEN T2.Country_Name = 'South Africa' THEN 1 ELSE 0 END) FROM City AS T1 INNER JOIN Country AS T2 ON T2.Country_Id = T1.Country_id",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T2.Country_Name = 'South Africa' THEN 1 ELSE 0 END) FROM City AS T1 INNER JOIN Country AS T2 ON T2.Country_Id = T1.Country_id",
"index": 923,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['South Africa', 'India']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSouth Africa refers to Country_Name = 'South Africa'\nHow many cities are located in South Africa?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the team refers to Team_Name; in 2011 refers to Match_Date LIKE '2011%'; the point of winning margin lower than 30% of the average winning margin refers to Win_Margin < multiply(avg(Win_Margin), 0.3) where Match_Date LIKE '2011%'\nList the names of the first andthe second teams that played a match with the point of the winning margin lower than the 30% of the average winning margin of the matches held in 2011.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT CASE WHEN T1.Win_Margin < ( SELECT AVG(Win_Margin) * 0.3 FROM Match WHERE Match_Date LIKE '2011%' ) THEN T2.Team_Name END, CASE WHEN T1.Win_Margin < ( SELECT AVG(Win_Margin) * 0.3 FROM Match WHERE Match_Date LIKE '2011%' ) THEN T3.Team_Name END FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Team_1 INNER JOIN Team AS T3 ON T3.Team_Id = T1.Team_2 WHERE T1.Match_Date LIKE '2011%'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT DISTINCT CASE WHEN T1.Win_Margin < ( SELECT AVG(Win_Margin) * 0.3 FROM Match WHERE Match_Date LIKE '2011%' ) THEN T2.Team_Name END, CASE WHEN T1.Win_Margin < ( SELECT AVG(Win_Margin) * 0.3 FROM Match WHERE Match_Date LIKE '2011%' ) THEN T3.Team_Name END FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Team_1 INNER JOIN Team AS T3 ON T3.Team_Id = T1.Team_2 WHERE T1.Match_Date LIKE '2011%'",
"index": 924,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the team refers to Team_Name; in 2011 refers to Match_Date LIKE '2011%'; the point of winning margin lower than 30% of the average winning margin refers to Win_Margin < multiply(avg(Win_Margin), 0.3) where Match_Date LIKE '2011%'\nList the names of the first andthe second teams that played a match with the point of the winning margin lower than the 30% of the average winning margin of the matches held in 2011.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Player', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in 1977 refers to DOB LIKE '1977%'; a role as a captain refers to Role_Desc = 'Captain'; percentage = divide(count(Role_Id where Role_Desc = 'Captain'), count(Role_Id)) * 100% where DOB LIKE '1977%'\nAmong the players born in 1977, what is the percentage of the players with a role as a captain?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T1.Role_Desc = 'Captain' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Role_Id) FROM Rolee AS T1 INNER JOIN Player_Match AS T2 ON T2.Role_Id = T1.Role_Id INNER JOIN Player AS T3 ON T3.Player_Id = T2.Player_Id WHERE T3.DOB LIKE '1977%'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T1.Role_Desc = 'Captain' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Role_Id) FROM Rolee AS T1 INNER JOIN Player_Match AS T2 ON T2.Role_Id = T1.Role_Id INNER JOIN Player AS T3 ON T3.Player_Id = T2.Player_Id WHERE T3.DOB LIKE '1977%'",
"index": 925,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Player', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in 1977 refers to DOB LIKE '1977%'; a role as a captain refers to Role_Desc = 'Captain'; percentage = divide(count(Role_Id where Role_Desc = 'Captain'), count(Role_Id)) * 100% where DOB LIKE '1977%'\nAmong the players born in 1977, what is the percentage of the players with a role as a captain?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nover ID refers to Over_Id; ball ID refers to Ball_Id; innings number refers to Innings_No; match ID \"336004\" refers to Match_Id = 336004; batsman got the maximum scores refers to max(Runs_Scored)\nList the over IDs, ball IDs, and innings numbers of the match ID \"336004\" while the batsman got the maximum scores.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT Over_Id, Ball_Id, Innings_No FROM Batsman_Scored WHERE Match_Id = 336004 ORDER BY Runs_Scored DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT Over_Id, Ball_Id, Innings_No FROM Batsman_Scored WHERE Match_Id = 336004 ORDER BY Runs_Scored DESC LIMIT 1",
"index": 926,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nover ID refers to Over_Id; ball ID refers to Ball_Id; innings number refers to Innings_No; match ID \"336004\" refers to Match_Id = 336004; batsman got the maximum scores refers to max(Runs_Scored)\nList the over IDs, ball IDs, and innings numbers of the match ID \"336004\" while the batsman got the maximum scores.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreached over ID 20 refers to Over_Id = 20\nDescribe any five matches IDs that reached over ID 20.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT Match_Id FROM Ball_by_Ball WHERE Over_Id = 20 GROUP BY Match_Id LIMIT 5",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT Match_Id FROM Ball_by_Ball WHERE Over_Id = 20 GROUP BY Match_Id LIMIT 5",
"index": 927,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreached over ID 20 refers to Over_Id = 20\nDescribe any five matches IDs that reached over ID 20.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2015-04-18', '2015-04-16', '2015-04-15', '2015-04-14', '2015-04-13', '2015-04-12']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Striker_Batting_Position integer, -- example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\non 18th April 2015 refers to DATE(Match_Date) = '2015-04-18'\nProvide the match IDs which were held on 18th April 2015.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT Match_Id FROM Match WHERE Match_Date LIKE '%2015-04-18%'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT Match_Id FROM Match WHERE Match_Date LIKE '%2015-04-18%'",
"index": 928,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2015-04-18', '2015-04-16', '2015-04-15', '2015-04-14', '2015-04-13', '2015-04-12']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Striker_Batting_Position integer, -- example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\non 18th April 2015 refers to DATE(Match_Date) = '2015-04-18'\nProvide the match IDs which were held on 18th April 2015.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['England', 'India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in 1977 refers to DOB LIKE '1977%'; name refers to Player_Name; birthdate refers to DOB; England refers to Country_Name = 'England'\nAmong the players who were born in 1977, provide names and birthdates of the players from England.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Player_Name, T2.DOB FROM Country AS T1 INNER JOIN Player AS T2 ON T2.Country_Name = T1.Country_Id WHERE T2.DOB LIKE '1977%' AND T1.Country_Name = 'England'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T2.Player_Name, T2.DOB FROM Country AS T1 INNER JOIN Player AS T2 ON T2.Country_Name = T1.Country_Id WHERE T2.DOB LIKE '1977%' AND T1.Country_Name = 'England'",
"index": 929,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['England', 'India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in 1977 refers to DOB LIKE '1977%'; name refers to Player_Name; birthdate refers to DOB; England refers to Country_Name = 'England'\nAmong the players who were born in 1977, provide names and birthdates of the players from England.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplayer's name refers to Player_Name; got the Man of the Series Award refers to Man_of_the_Match = Player_Id; in 2010 refers to Season_Year = 2010\nWho got the Man of the Series Award in 2010?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.Player_Name FROM Player AS T1 INNER JOIN Match AS T2 ON T2.Man_of_the_Match = T1.Player_Id INNER JOIN Season AS T3 ON T3.Season_Id = T2.Season_Id WHERE T3.Season_Year = 2010 GROUP BY T1.Player_Name",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T1.Player_Name FROM Player AS T1 INNER JOIN Match AS T2 ON T2.Man_of_the_Match = T1.Player_Id INNER JOIN Season AS T3 ON T3.Season_Id = T2.Season_Id WHERE T3.Season_Year = 2010 GROUP BY T1.Player_Name",
"index": 930,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplayer's name refers to Player_Name; got the Man of the Series Award refers to Man_of_the_Match = Player_Id; in 2010 refers to Season_Year = 2010\nWho got the Man of the Series Award in 2010?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Chennai Super Kings', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteam \"Chennai Super Kings\" refers to Team_Name = 'Chennai Super Kings'; win rate = divide(count(Match_Id where Match_Winner = 3), count(Match_Id)) * 100%\nCalculate the win rate of the team \"Chennai Super Kings\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T1.Match_Winner = 3 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Match_Id) FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Team_1 INNER JOIN Team AS T3 ON T3.Team_Id = T1.Team_2 WHERE T2.Team_Name = 'Chennai Super Kings' OR T3.Team_Name = 'Chennai Super Kings'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T1.Match_Winner = 3 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Match_Id) FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Team_1 INNER JOIN Team AS T3 ON T3.Team_Id = T1.Team_2 WHERE T2.Team_Name = 'Chennai Super Kings' OR T3.Team_Name = 'Chennai Super Kings'",
"index": 931,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Chennai Super Kings', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteam \"Chennai Super Kings\" refers to Team_Name = 'Chennai Super Kings'; win rate = divide(count(Match_Id where Match_Winner = 3), count(Match_Id)) * 100%\nCalculate the win rate of the team \"Chennai Super Kings\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Gujarat Lions', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2016-04-11', '2016-04-18', '2016-04-17', '2016-04-16', '2016-04-15', '2016-04-14']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplayer's name refers to Player_Name; country refers to Country_Name; Gujarat Lions refers to Team_Name = 'Gujarat Lions'; on 11th April 2016 refers to Match_Date = '2016-04-11'\nList the names and countries of the players from Gujarat Lions who played in the match held on 11th April 2016.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T4.Player_Name, T5.Country_Name FROM Player_Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Team_Id INNER JOIN Match AS T3 ON T3.Match_Id = T1.Match_Id INNER JOIN Player AS T4 ON T4.Player_Id = T1.Player_Id INNER JOIN Country AS T5 ON T5.Country_Id = T4.Country_Name WHERE T2.Team_Name = 'Gujarat Lions' AND T3.Match_Date = '2016-04-11'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T4.Player_Name, T5.Country_Name FROM Player_Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Team_Id INNER JOIN Match AS T3 ON T3.Match_Id = T1.Match_Id INNER JOIN Player AS T4 ON T4.Player_Id = T1.Player_Id INNER JOIN Country AS T5 ON T5.Country_Id = T4.Country_Name WHERE T2.Team_Name = 'Gujarat Lions' AND T3.Match_Date = '2016-04-11'",
"index": 932,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Gujarat Lions', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2016-04-11', '2016-04-18', '2016-04-17', '2016-04-16', '2016-04-15', '2016-04-14']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplayer's name refers to Player_Name; country refers to Country_Name; Gujarat Lions refers to Team_Name = 'Gujarat Lions'; on 11th April 2016 refers to Match_Date = '2016-04-11'\nList the names and countries of the players from Gujarat Lions who played in the match held on 11th April 2016.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['CK Kapugedera', 'SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteam refers to Team_Name; CK Kapugedera refers to Player_Name = 'CK Kapugedera'\nWhich team did CK Kapugedera belong to? How many matches did he 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 T3.Team_Name, COUNT(T2.Match_Id) FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T2.Player_Id = T1.Player_Id INNER JOIN Team AS T3 ON T3.Team_Id = T2.Team_Id WHERE T1.Player_Name = 'CK Kapugedera'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T3.Team_Name, COUNT(T2.Match_Id) FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T2.Player_Id = T1.Player_Id INNER JOIN Team AS T3 ON T3.Team_Id = T2.Team_Id WHERE T1.Player_Name = 'CK Kapugedera'",
"index": 933,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['CK Kapugedera', 'SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteam refers to Team_Name; CK Kapugedera refers to Player_Name = 'CK Kapugedera'\nWhich team did CK Kapugedera belong to? How many matches did he 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 Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Striker_Batting_Position integer, -- example: [1, 2]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Mumbai', 'Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['Wankhede Stadium', 'M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMumbai refers to City_Name = 'Mumbai'; Wankhede Stadium refers to Venue_Name = 'Wankhede Stadium'; percent = divide(count(Match_Id where Venue_Name = 'Wankhede Stadium'), count(Match_Id)) * 100% where City_Name = 'Mumbai'\nAmong the matches held in Mumbai, how many percent of them were held in Wankhede Stadium?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T2.Venue_Name = 'Wankhede Stadium' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T3.Match_Id) FROM City AS T1 INNER JOIN Venue AS T2 ON T2.City_Id = T1.City_Id INNER JOIN Match AS T3 ON T3.Venue_Id = T2.Venue_Id WHERE T1.City_Name = 'Mumbai'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T2.Venue_Name = 'Wankhede Stadium' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T3.Match_Id) FROM City AS T1 INNER JOIN Venue AS T2 ON T2.City_Id = T1.City_Id INNER JOIN Match AS T3 ON T3.Venue_Id = T2.Venue_Id WHERE T1.City_Name = 'Mumbai'",
"index": 934,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Striker_Batting_Position integer, -- example: [1, 2]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Mumbai', 'Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['Wankhede Stadium', 'M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMumbai refers to City_Name = 'Mumbai'; Wankhede Stadium refers to Venue_Name = 'Wankhede Stadium'; percent = divide(count(Match_Id where Venue_Name = 'Wankhede Stadium'), count(Match_Id)) * 100% where City_Name = 'Mumbai'\nAmong the matches held in Mumbai, how many percent of them were held in Wankhede Stadium?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['bowled', 'caught']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nout by bowl refers to Out_Name = 'bowled'; percentage = divide(count(Player_Out where Out_Name = 'bowled'), count(Player_Out)) * 100% where Match_Id = 392187\nAmong the players out in match ID 392187, calculate the percentage of players out by bowl.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T2.Out_Name = 'bowled' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Player_Out) FROM Wicket_Taken AS T1 INNER JOIN Out_Type AS T2 ON T2.Out_Id = T1.Kind_Out WHERE T1.Match_Id = 392187",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T2.Out_Name = 'bowled' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Player_Out) FROM Wicket_Taken AS T1 INNER JOIN Out_Type AS T2 ON T2.Out_Id = T1.Kind_Out WHERE T1.Match_Id = 392187",
"index": 935,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['bowled', 'caught']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nout by bowl refers to Out_Name = 'bowled'; percentage = divide(count(Player_Out where Out_Name = 'bowled'), count(Player_Out)) * 100% where Match_Id = 392187\nAmong the players out in match ID 392187, calculate the percentage of players out by bowl.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['bat', 'field']\n PRIMARY KEY (Toss_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndecided to bat refers to Toss_Decide = 2; ID of toss winners refers to Toss_winner\nList down the ID of toss winners who decided to bat after winning the \"toss of the coin\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT Toss_Winner FROM Match WHERE Toss_Decide = 2",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT Toss_Winner FROM Match WHERE Toss_Decide = 2",
"index": 936,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['bat', 'field']\n PRIMARY KEY (Toss_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndecided to bat refers to Toss_Decide = 2; ID of toss winners refers to Toss_winner\nList down the ID of toss winners who decided to bat after winning the \"toss of the coin\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList down the DOB of players who received the \"man of the match\" 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 T2.DOB FROM Match AS T1 INNER JOIN Player AS T2 ON T2.Player_Id = T1.Man_of_the_Match",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T2.DOB FROM Match AS T1 INNER JOIN Player AS T2 ON T2.Player_Id = T1.Man_of_the_Match",
"index": 937,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList down the DOB of players who received the \"man of the match\" 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 Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of teams refers to Team_Name; won the toss refers to Toss_Winner; matches with ID from 336010 to 336020 refers to Match_Id BETWEEN 336010 AND 336020\nList down the name of teams that won the toss of the coin from matches with ID from 336010 to 336020.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Team_Name FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Toss_Winner WHERE T1.Match_Id BETWEEN 336010 AND 336020",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T2.Team_Name FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Toss_Winner WHERE T1.Match_Id BETWEEN 336010 AND 336020",
"index": 938,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of teams refers to Team_Name; won the toss refers to Toss_Winner; matches with ID from 336010 to 336020 refers to Match_Id BETWEEN 336010 AND 336020\nList down the name of teams that won the toss of the coin from matches with ID from 336010 to 336020.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Pune', 'Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Pune Warriors', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of teams refers to Team_Name; second team refers to Team_2; Pune Warriors refers to Team_Name = 'Pune Warriors'\nList down names of teams that have played as second team against Pune Warriors.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Team_Name FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Team_2 WHERE T1.Team_1 = ( SELECT Team_Id FROM Team WHERE Team_Name = 'Pune Warriors' ) GROUP BY T2.Team_Name",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T2.Team_Name FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Team_2 WHERE T1.Team_1 = ( SELECT Team_Id FROM Team WHERE Team_Name = 'Pune Warriors' ) GROUP BY T2.Team_Name",
"index": 939,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Pune', 'Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Pune Warriors', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of teams refers to Team_Name; second team refers to Team_2; Pune Warriors refers to Team_Name = 'Pune Warriors'\nList down names of teams that have played as second team against Pune Warriors.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the team refers to Team_Name; won refers to Match_Winner\nWhat is the name of the team that won match ID 336000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Team_Name FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Match_Winner WHERE T1.Match_Id = 336000",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T2.Team_Name FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Match_Winner WHERE T1.Match_Id = 336000",
"index": 940,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the team refers to Team_Name; won refers to Match_Winner\nWhat is the name of the team that won match ID 336000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Mumbai', 'Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nvenues refers to Venue_Name; Mumbai refers to City_Name = 'Mumbai'\nList down all of the venues in Mumbai.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Venue_Name FROM City AS T1 INNER JOIN Venue AS T2 ON T2.City_Id = T1.City_Id WHERE T1.City_Name = 'Mumbai'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T2.Venue_Name FROM City AS T1 INNER JOIN Venue AS T2 ON T2.City_Id = T1.City_Id WHERE T1.City_Name = 'Mumbai'",
"index": 941,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Mumbai', 'Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nvenues refers to Venue_Name; Mumbai refers to City_Name = 'Mumbai'\nList down all of the venues in Mumbai.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: [\"St George's Park\", 'M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwinning teams' refers to Match_Winner; played in St George's Park refers to Venue_Name like 'St George%'\nList down all of the winning teams' IDs that played in St George's Park.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Match_Winner FROM Venue AS T1 INNER JOIN Match AS T2 ON T1.Venue_Id = T2.Venue_Id WHERE T1.Venue_Name LIKE 'St George%'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T2.Match_Winner FROM Venue AS T1 INNER JOIN Match AS T2 ON T1.Venue_Id = T2.Venue_Id WHERE T1.Venue_Name LIKE 'St George%'",
"index": 942,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: [\"St George's Park\", 'M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwinning teams' refers to Match_Winner; played in St George's Park refers to Venue_Name like 'St George%'\nList down all of the winning teams' IDs that played in St George's Park.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Centurion', 'Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['SuperSport Park', 'M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSuperSport Park refers to Venue_Name = 'SuperSport Park'; Centurion refers to City_Name = 'Centurion'\nIs SuperSport Park located at Centurion?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.City_Name FROM Venue AS T1 INNER JOIN City AS T2 ON T1.City_Id = T2.City_Id WHERE T1.Venue_Name LIKE 'St George%'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T2.City_Name FROM Venue AS T1 INNER JOIN City AS T2 ON T1.City_Id = T2.City_Id WHERE T1.Venue_Name LIKE 'St George%'",
"index": 943,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Centurion', 'Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['SuperSport Park', 'M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSuperSport Park refers to Venue_Name = 'SuperSport Park'; Centurion refers to City_Name = 'Centurion'\nIs SuperSport Park located at Centurion?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Deccan Chargers', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwinning refers to Match_Winner; Deccan Chargers refers to Team_Name = 'Deccan Chargers'\nCalculate the total winning match for Deccan Chargers.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Match_Winner) FROM Team AS T1 INNER JOIN Match AS T2 ON T1.Team_Id = T2.Match_Winner WHERE T1.Team_Name = 'Deccan Chargers'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT SUM(T2.Match_Winner) FROM Team AS T1 INNER JOIN Match AS T2 ON T1.Team_Id = T2.Match_Winner WHERE T1.Team_Name = 'Deccan Chargers'",
"index": 944,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Deccan Chargers', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwinning refers to Match_Winner; Deccan Chargers refers to Team_Name = 'Deccan Chargers'\nCalculate the total winning match for Deccan Chargers.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Pune', 'Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPune City refers to City_Name = 'Pune'\nCount the total venues located in Pune City.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T1.Venue_Name) FROM Venue AS T1 INNER JOIN City AS T2 ON T1.City_Id = T2.City_Id WHERE T2.City_Name = 'Pune'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT SUM(T1.Venue_Name) FROM Venue AS T1 INNER JOIN City AS T2 ON T1.City_Id = T2.City_Id WHERE T2.City_Name = 'Pune'",
"index": 945,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Pune', 'Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPune City refers to City_Name = 'Pune'\nCount the total venues located in Pune City.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost number of balls refers to max(Ball_Id); match 501219 refers to Match_Id = 501219;\nplayer id also refers to non_striker or ball_id\nGive the player id of the player who was at the non-striker end for the most number of balls in the match 501219.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT Ball_Id FROM Ball_by_Ball WHERE Non_Striker = Ball_Id ORDER BY Ball_Id DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT Ball_Id FROM Ball_by_Ball WHERE Non_Striker = Ball_Id ORDER BY Ball_Id DESC LIMIT 1",
"index": 946,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost number of balls refers to max(Ball_Id); match 501219 refers to Match_Id = 501219;\nplayer id also refers to non_striker or ball_id\nGive the player id of the player who was at the non-striker end for the most number of balls in the match 501219.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfirst half refers to 1 < Over_Id and Over_Id < 25; average = divide(sum(Over_Id) when 1 < Over_Id and Over_Id < 25, sum(Runs_Scored)) as percentage; first innings refers to Innings_No = 1\nCalculate the average runs scored during the first half of all first innings.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN 1 < Over_Id AND Over_Id < 25 THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(Runs_Scored) FROM Batsman_Scored WHERE Innings_No = 1",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN 1 < Over_Id AND Over_Id < 25 THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(Runs_Scored) FROM Batsman_Scored WHERE Innings_No = 1",
"index": 947,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfirst half refers to 1 < Over_Id and Over_Id < 25; average = divide(sum(Over_Id) when 1 < Over_Id and Over_Id < 25, sum(Runs_Scored)) as percentage; first innings refers to Innings_No = 1\nCalculate the average runs scored during the first half of all first innings.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsecond innings refers to Innings_No = 2; average extra runs = divide(sum(Extra_Runs), count(Innings_No)) when Innings_No = 2\nWhat are the average extra runs given in the second innings of every match?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT AVG(Innings_No) FROM Extra_Runs WHERE Innings_No = 2",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT AVG(Innings_No) FROM Extra_Runs WHERE Innings_No = 2",
"index": 948,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsecond innings refers to Innings_No = 2; average extra runs = divide(sum(Extra_Runs), count(Innings_No)) when Innings_No = 2\nWhat are the average extra runs given in the second innings of every match?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwinning margin above 100 refers to Win_Margin > 100; percentage = divide(count(Match_Id) when Win_Margin > 100, count(Match_Id)) as percentage\nAmong the matches, what percentage have a winning margin above 100?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(COUNT(CASE WHEN Win_Margin > 100 THEN 1 ELSE 0 END) AS REAL) * 100 / TOTAL(Match_Id) FROM `Match`",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN Win_Margin > 100 THEN 1 ELSE 0 END) AS REAL) * 100 / TOTAL(Match_Id) FROM `Match`",
"index": 949,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwinning margin above 100 refers to Win_Margin > 100; percentage = divide(count(Match_Id) when Win_Margin > 100, count(Match_Id)) as percentage\nAmong the matches, what percentage have a winning margin above 100?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the players refers to Player_Name; born between 1970 and 1990 refers to DOB between '1970-01-01' and '1990-12-31'\nList the name of the players born between 1970 and 1990 in descending order of age.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT Player_Name FROM Player WHERE DOB BETWEEN '1970-01-01' AND '1990-12-31' ORDER BY DOB DESC",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT Player_Name FROM Player WHERE DOB BETWEEN '1970-01-01' AND '1990-12-31' ORDER BY DOB DESC",
"index": 950,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the players refers to Player_Name; born between 1970 and 1990 refers to DOB between '1970-01-01' and '1990-12-31'\nList the name of the players born between 1970 and 1990 in descending order of age.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Right-hand bat', 'Left-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['bat', 'field']\n PRIMARY KEY (Toss_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbat with their right hand refers to Batting_hand = 'Right-hand bat'; average = divide(count(Player_Id) when Batting_hand = 'Right-hand bat', count(Country_Name))\nOn average, how many players from each country bat with their right 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 CAST(SUM(CASE WHEN T1.Batting_hand = 'Right-hand bat' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.Country_Name) FROM Batting_Style AS T1 INNER JOIN Player AS T2 ON T1.Batting_id = T2.Batting_hand",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T1.Batting_hand = 'Right-hand bat' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.Country_Name) FROM Batting_Style AS T1 INNER JOIN Player AS T2 ON T1.Batting_id = T2.Batting_hand",
"index": 951,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Right-hand bat', 'Left-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['bat', 'field']\n PRIMARY KEY (Toss_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbat with their right hand refers to Batting_hand = 'Right-hand bat'; average = divide(count(Player_Id) when Batting_hand = 'Right-hand bat', count(Country_Name))\nOn average, how many players from each country bat with their right 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 Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Legbreak', 'Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLegbreak skill refers to Bowling_skill = 'Legbreak' ; percentage = divide(sum(Player_Id) when Bowling_skill = 'Legbreak', count(Player_Id)) as percentage\nWhat percentage of players have Legbreak skill?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T2.Bowling_skill = ' Legbreak' THEN 1 ELSE 0 END) AS REAL) * 100 / TOTAL(T1.Player_Id) FROM Player AS T1 INNER JOIN Bowling_Style AS T2 ON T1.Bowling_skill = T2.Bowling_Id",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T2.Bowling_skill = ' Legbreak' THEN 1 ELSE 0 END) AS REAL) * 100 / TOTAL(T1.Player_Id) FROM Player AS T1 INNER JOIN Bowling_Style AS T2 ON T1.Bowling_skill = T2.Bowling_Id",
"index": 952,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Legbreak', 'Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLegbreak skill refers to Bowling_skill = 'Legbreak' ; percentage = divide(sum(Player_Id) when Bowling_skill = 'Legbreak', count(Player_Id)) as percentage\nWhat percentage of players have Legbreak skill?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['wickets', 'runs']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwinning margin is less than fifty refers to Win_Margin < 50; won by wicket refers to Win_Type = 'wickets'\nIn the matches where the winning margin is less than fifty, how many teams won by wicket?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Win_Id) FROM `Match` AS T1 INNER JOIN Win_By AS T2 ON T1.Win_Type = T2.Win_Id WHERE T2.Win_Type = 'wickets' AND T1.Win_Margin < 50",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT COUNT(T2.Win_Id) FROM `Match` AS T1 INNER JOIN Win_By AS T2 ON T1.Win_Type = T2.Win_Id WHERE T2.Win_Type = 'wickets' AND T1.Win_Margin < 50",
"index": 953,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['wickets', 'runs']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwinning margin is less than fifty refers to Win_Margin < 50; won by wicket refers to Win_Type = 'wickets'\nIn the matches where the winning margin is less than fifty, how many teams won by wicket?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nyear 2012 refers to Season_Year = 2012; name of player refers to Player_Name.; country of this player refers to Country_Name\nWhich player became the man of the series in the year 2012? Give the name and country of this 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 T2.Player_Name, T3.Country_Name FROM Season AS T1 INNER JOIN Player AS T2 ON T1.Man_of_the_Series = T2.Player_Id INNER JOIN Country AS T3 ON T2.Country_Name = T3.Country_Id WHERE T1.Season_Year = 2012",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T2.Player_Name, T3.Country_Name FROM Season AS T1 INNER JOIN Player AS T2 ON T1.Man_of_the_Series = T2.Player_Id INNER JOIN Country AS T3 ON T2.Country_Name = T3.Country_Id WHERE T1.Season_Year = 2012",
"index": 954,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nyear 2012 refers to Season_Year = 2012; name of player refers to Player_Name.; country of this player refers to Country_Name\nWhich player became the man of the series in the year 2012? Give the name and country of this 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 Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the venue refers to Venue_Name; most number of matches refers to max(count(Venue_Id))\nGive the name of the venue where the most number of matches are held.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.Venue_Name FROM `Match` AS T1 INNER JOIN Venue AS T2 ON T1.Venue_Id = T2.Venue_Id GROUP BY T2.Venue_Name ORDER BY COUNT(T2.Venue_Id) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T2.Venue_Name FROM `Match` AS T1 INNER JOIN Venue AS T2 ON T1.Venue_Id = T2.Venue_Id GROUP BY T2.Venue_Name ORDER BY COUNT(T2.Venue_Id) DESC LIMIT 1",
"index": 955,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the venue refers to Venue_Name; most number of matches refers to max(count(Venue_Id))\nGive the name of the venue where the most number of matches are held.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncity refers to City_Name; no-result matches refers to Win_type = 'NoResult'; least number refers to min(count(Win_type = 'NoResult'))\nWhich city hosted the least number of no-result matches?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T4.City_Name FROM `Match` AS T1 INNER JOIN Win_By AS T2 ON T1.Win_Type = T2.Win_Id INNER JOIN Venue AS T3 ON T1.Venue_Id = T3.Venue_Id INNER JOIN City AS T4 ON T3.City_Id = T4.City_Id WHERE T2.Win_Type = 'NO Result' GROUP BY T4.City_Id ORDER BY COUNT(T2.Win_Type) ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T4.City_Name FROM `Match` AS T1 INNER JOIN Win_By AS T2 ON T1.Win_Type = T2.Win_Id INNER JOIN Venue AS T3 ON T1.Venue_Id = T3.Venue_Id INNER JOIN City AS T4 ON T3.City_Id = T4.City_Id WHERE T2.Win_Type = 'NO Result' GROUP BY T4.City_Id ORDER BY COUNT(T2.Win_Type) ASC LIMIT 1",
"index": 956,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncity refers to City_Name; no-result matches refers to Win_type = 'NoResult'; least number refers to min(count(Win_type = 'NoResult'))\nWhich city hosted the least number of no-result matches?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwon by runs refers to Win_Type = 'runs'; won the toss and decided to field refers to Toss_Winner and Toss_Name = 'field'; percentage = divide(count(Team_1) when Match_Winner = Team_1 and Toss_Winner = Team_1, count(Team_1)) as percentage\nOf the matches that were won by runs by team 1, what percentage have team 1 won the toss and decided to field?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(COUNT(CASE WHEN T1.Team_1 = T1.Match_Winner = T1.Toss_Winner THEN 1 ELSE 0 END) AS REAL) * 100 / TOTAL(T1.Team_1) FROM `Match` AS T1 INNER JOIN Win_By AS T2 ON T1.Win_Type = T2.Win_Id INNER JOIN Toss_Decision AS T3 ON T1.Toss_Decide = T3.Toss_Id WHERE T3.Toss_Name = 'field' AND T2.Win_Type = 'runs'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN T1.Team_1 = T1.Match_Winner = T1.Toss_Winner THEN 1 ELSE 0 END) AS REAL) * 100 / TOTAL(T1.Team_1) FROM `Match` AS T1 INNER JOIN Win_By AS T2 ON T1.Win_Type = T2.Win_Id INNER JOIN Toss_Decision AS T3 ON T1.Toss_Decide = T3.Toss_Id WHERE T3.Toss_Name = 'field' AND T2.Win_Type = 'runs'",
"index": 957,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwon by runs refers to Win_Type = 'runs'; won the toss and decided to field refers to Toss_Winner and Toss_Name = 'field'; percentage = divide(count(Team_1) when Match_Winner = Team_1 and Toss_Winner = Team_1, count(Team_1)) as percentage\nOf the matches that were won by runs by team 1, what percentage have team 1 won the toss and decided to field?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Striker_Batting_Position integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfirst teams refers to Team_1; chose to bat after winning the toss refers to Toss_Winner and Toss_Decide = 2\nHow many first teams chose to bat after winning the toss?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(Team_1) FROM `Match` WHERE Team_1 = Toss_Winner AND Toss_Decide = 2",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT COUNT(Team_1) FROM `Match` WHERE Team_1 = Toss_Winner AND Toss_Decide = 2",
"index": 958,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Striker_Batting_Position integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfirst teams refers to Team_1; chose to bat after winning the toss refers to Toss_Winner and Toss_Decide = 2\nHow many first teams chose to bat after winning the toss?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Delhi Daredevils', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nif a player has multiple roles in a match, it means this player is versatile; name refers to Player_Name; most versatile player refers to MAX(COUNT(Role_id)); Delhi Daredevils refers to Team_Name = 'Delhi Daredevils'\nIndicate the name of the most versatile players of the Delhi Daredevils.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Player_Name FROM Player_Match AS T1 INNER JOIN Team AS T2 ON T1.Team_Id = T2.Team_Id INNER JOIN Player AS T3 ON T1.Player_Id = T3.Player_Id WHERE T2.Team_Name = 'Delhi Daredevils' GROUP BY T3.Player_Name ORDER BY COUNT(T1.Role_Id) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T3.Player_Name FROM Player_Match AS T1 INNER JOIN Team AS T2 ON T1.Team_Id = T2.Team_Id INNER JOIN Player AS T3 ON T1.Player_Id = T3.Player_Id WHERE T2.Team_Name = 'Delhi Daredevils' GROUP BY T3.Player_Name ORDER BY COUNT(T1.Role_Id) DESC LIMIT 1",
"index": 959,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Delhi Daredevils', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nif a player has multiple roles in a match, it means this player is versatile; name refers to Player_Name; most versatile player refers to MAX(COUNT(Role_id)); Delhi Daredevils refers to Team_Name = 'Delhi Daredevils'\nIndicate the name of the most versatile players of the Delhi Daredevils.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Striker integer, -- example: [1, 6]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the player refers to Player_Name; most times for 'Man of the Series' refers to max(count(Man_of_the_Match))\nWhat is the name of the player who has been chosen the most times for 'Man of the Series'?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Player_Name FROM Season AS T1 INNER JOIN Match AS T2 ON T1.Man_of_the_Series = T2.Man_of_the_Match INNER JOIN Player AS T3 ON T2.Man_of_the_Match = T3.Player_Id GROUP BY T3.Player_Name ORDER BY COUNT(T1.Man_of_the_Series) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T3.Player_Name FROM Season AS T1 INNER JOIN Match AS T2 ON T1.Man_of_the_Series = T2.Man_of_the_Match INNER JOIN Player AS T3 ON T2.Man_of_the_Match = T3.Player_Id GROUP BY T3.Player_Name ORDER BY COUNT(T1.Man_of_the_Series) DESC LIMIT 1",
"index": 960,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Striker integer, -- example: [1, 6]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the player refers to Player_Name; most times for 'Man of the Series' refers to max(count(Man_of_the_Match))\nWhat is the name of the player who has been chosen the most times for 'Man of the Series'?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SP Narine', 'SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nyear refers to Season_Year\nIn what year did SP Narine win the Orange Cap?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T4.Season_Year, T4.Orange_Cap FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T1.Player_Id = T2.Player_Id INNER JOIN Match AS T3 ON T2.Match_Id = T3.Match_Id INNER JOIN Season AS T4 ON T3.Season_Id = T4.Season_Id WHERE T1.Player_Name = 'SP Narine' GROUP BY T4.Season_Year, T4.Orange_Cap",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T4.Season_Year, T4.Orange_Cap FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T1.Player_Id = T2.Player_Id INNER JOIN Match AS T3 ON T2.Match_Id = T3.Match_Id INNER JOIN Season AS T4 ON T3.Season_Id = T4.Season_Id WHERE T1.Player_Name = 'SP Narine' GROUP BY T4.Season_Year, T4.Orange_Cap",
"index": 961,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SP Narine', 'SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nyear refers to Season_Year\nIn what year did SP Narine win the Orange Cap?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich teams have had a player awarded the Purple Cap and another with the Orange Cap in the same 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 T5.Team_Name, T1.Orange_Cap, T1.Purple_Cap FROM Season AS T1 INNER JOIN Match AS T2 ON T1.Season_Id = T2.Season_Id INNER JOIN Player_Match AS T3 ON T2.Match_Id = T3.Match_Id INNER JOIN Player AS T4 ON T3.Player_Id = T4.Player_Id INNER JOIN Team AS T5 ON T3.Team_Id = T5.Team_Id GROUP BY T5.Team_Name, T1.Orange_Cap, T1.Purple_Cap",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T5.Team_Name, T1.Orange_Cap, T1.Purple_Cap FROM Season AS T1 INNER JOIN Match AS T2 ON T1.Season_Id = T2.Season_Id INNER JOIN Player_Match AS T3 ON T2.Match_Id = T3.Match_Id INNER JOIN Player AS T4 ON T3.Player_Id = T4.Player_Id INNER JOIN Team AS T5 ON T3.Team_Id = T5.Team_Id GROUP BY T5.Team_Name, T1.Orange_Cap, T1.Purple_Cap",
"index": 962,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich teams have had a player awarded the Purple Cap and another with the Orange Cap in the same 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 City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['Zimbabwea', 'India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nZimbabwean refers to Country_Name = 'Zimbabwea'; players refers to Player_Name\nList all Zimbabwean players.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.Player_Name FROM Player AS T1 INNER JOIN Country AS T2 ON T1.Country_Name = T2.Country_Id WHERE T2.Country_Name = 'Zimbabwea'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T1.Player_Name FROM Player AS T1 INNER JOIN Country AS T2 ON T1.Country_Name = T2.Country_Id WHERE T2.Country_Name = 'Zimbabwea'",
"index": 963,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['Zimbabwea', 'India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nZimbabwean refers to Country_Name = 'Zimbabwea'; players refers to Player_Name\nList all Zimbabwean 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 Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['New Zealand', 'India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNew Zealand umpires refers to Country_Name = 'New Zealand'; name of umpires refers to Umpire_Name\nList the name of all New Zealand umpires.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Umpire_Name FROM Umpire AS T1 INNER JOIN Country AS T2 ON T1.Umpire_Country = T2.Country_Id WHERE T2.Country_Name = 'New Zealand'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T1.Umpire_Name FROM Umpire AS T1 INNER JOIN Country AS T2 ON T1.Umpire_Country = T2.Country_Id WHERE T2.Country_Name = 'New Zealand'",
"index": 964,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['New Zealand', 'India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNew Zealand umpires refers to Country_Name = 'New Zealand'; name of umpires refers to Umpire_Name\nList the name of all New Zealand umpires.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Slow left-arm chinaman', 'Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n'slow left-arm chinaman' bowling style refers to Bowling_skill = 'Slow left-arm chinaman'; most players refers to max(count(Country_Id))\nIn which country do most players have the 'slow left-arm chinaman' bowling style?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Country_Name FROM Bowling_Style AS T1 INNER JOIN Player AS T2 ON T1.Bowling_Id = T2.Bowling_skill INNER JOIN Country AS T3 ON T2.Country_Name = T3.Country_Id WHERE T1.Bowling_skill = 'Slow left-arm chinaman'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T3.Country_Name FROM Bowling_Style AS T1 INNER JOIN Player AS T2 ON T1.Bowling_Id = T2.Bowling_skill INNER JOIN Country AS T3 ON T2.Country_Name = T3.Country_Id WHERE T1.Bowling_skill = 'Slow left-arm chinaman'",
"index": 965,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Slow left-arm chinaman', 'Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n'slow left-arm chinaman' bowling style refers to Bowling_skill = 'Slow left-arm chinaman'; most players refers to max(count(Country_Id))\nIn which country do most players have the 'slow left-arm chinaman' bowling style?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Delhi', 'Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Delhi Daredevils', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['bat', 'field']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbatting team was the Delhi Daredevils refers to Team_Name = 'Delhi Daredevils' and Team_1 = Team_Id where Team_Batting = 1 or Team_2 = Team_Id where Team_Batting = 2; no runs scored refers to Runs_Scored = 0\nIn how many games in which the batting team was the Delhi Daredevils were no runs 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 COUNT(T1.Runs_Scored) FROM Batsman_Scored AS T1 INNER JOIN Ball_by_Ball AS T2 ON T1.Match_Id = T2.Match_Id INNER JOIN Match AS T3 ON T2.Match_Id = T3.Match_Id INNER JOIN Team AS T4 ON T3.Team_1 = T4.Team_Id WHERE T2.Team_Batting = 1 OR T2.Team_Batting = 2 AND T4.Team_Name = 'Delhi Daredevils'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT COUNT(T1.Runs_Scored) FROM Batsman_Scored AS T1 INNER JOIN Ball_by_Ball AS T2 ON T1.Match_Id = T2.Match_Id INNER JOIN Match AS T3 ON T2.Match_Id = T3.Match_Id INNER JOIN Team AS T4 ON T3.Team_1 = T4.Team_Id WHERE T2.Team_Batting = 1 OR T2.Team_Batting = 2 AND T4.Team_Name = 'Delhi Daredevils'",
"index": 966,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Delhi', 'Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Delhi Daredevils', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['bat', 'field']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbatting team was the Delhi Daredevils refers to Team_Name = 'Delhi Daredevils' and Team_1 = Team_Id where Team_Batting = 1 or Team_2 = Team_Id where Team_Batting = 2; no runs scored refers to Runs_Scored = 0\nIn how many games in which the batting team was the Delhi Daredevils were no runs 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 City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['Dr DY Patil Sports Academy', 'M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDr DY Patil Sports Academy venue refers to Venue_Name = 'Dr DY Patil Sports Academy'; win by a margin of less than 10 refers to Win_Margin < 10; percentage = divide(count(Venue_Id) when Win_Margin < 10, sum(Venue_Id)) as percentage\nIn what percentage of games played at the Dr DY Patil Sports Academy venue did the winning team win by a margin of less than 10?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(COUNT(CASE WHEN T2.Win_Margin < 10 THEN 1 ELSE 0 END) AS REAL) * 100 / TOTAL(T1.Venue_Id) FROM Venue AS T1 INNER JOIN Match AS T2 ON T1.Venue_Id = T2.Venue_Id WHERE T1.Venue_Name = 'Dr DY Patil Sports Academy'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN T2.Win_Margin < 10 THEN 1 ELSE 0 END) AS REAL) * 100 / TOTAL(T1.Venue_Id) FROM Venue AS T1 INNER JOIN Match AS T2 ON T1.Venue_Id = T2.Venue_Id WHERE T1.Venue_Name = 'Dr DY Patil Sports Academy'",
"index": 967,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['Dr DY Patil Sports Academy', 'M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDr DY Patil Sports Academy venue refers to Venue_Name = 'Dr DY Patil Sports Academy'; win by a margin of less than 10 refers to Win_Margin < 10; percentage = divide(count(Venue_Id) when Win_Margin < 10, sum(Venue_Id)) as percentage\nIn what percentage of games played at the Dr DY Patil Sports Academy venue did the winning team win by a margin of less than 10?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['noballs', 'legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnoballs refers to Extra_Name = 'noballs' ; average number = divide(sum(Extra_Runs), count(Extra_Runs))\nWhat is the average number of extra runs made as noballs?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT AVG(T1.Extra_Runs) FROM Extra_Runs AS T1 INNER JOIN Extra_Type AS T2 ON T1.Extra_Type_Id = T2.Extra_Id WHERE T2.Extra_Name = 'noballs'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT AVG(T1.Extra_Runs) FROM Extra_Runs AS T1 INNER JOIN Extra_Type AS T2 ON T1.Extra_Type_Id = T2.Extra_Id WHERE T2.Extra_Name = 'noballs'",
"index": 968,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['noballs', 'legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnoballs refers to Extra_Name = 'noballs' ; average number = divide(sum(Extra_Runs), count(Extra_Runs))\nWhat is the average number of extra runs made as noballs?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1975-10-16', '1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn before 10/16/1975 refers to DOB < 1975-10-16; bowling skill of less than 3 refers to Bowling_skill < 3\nHow many players were born before 10/16/1975, and have a bowling skill of less than 3?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM Player WHERE DOB < '1975-10-16' AND Bowling_skill < 3",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT COUNT(*) FROM Player WHERE DOB < '1975-10-16' AND Bowling_skill < 3",
"index": 969,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1975-10-16', '1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn before 10/16/1975 refers to DOB < 1975-10-16; bowling skill of less than 3 refers to Bowling_skill < 3\nHow many players were born before 10/16/1975, and have a bowling skill of less than 3?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBetween match no. 335989 and 337000 refers to 335989 < Match_Id < 337000; batsman score more than 3 runs during over no. 1, ball no. 1, and inning no. 1 of the matches refers to Runs_Scored > 3 and Over_Id = 1 and Ball_Id = 1 and Innings_No = 1\nBetween match nos. 335989 and 337000, how many times did a batsman score more than 3 runs during over no. 1, ball no. 1, and inning no. 1 of the matches?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Runs_Scored > 3 THEN 1 ELSE 0 END) FROM Batsman_Scored WHERE 335989 < Match_Id < 337000 AND Innings_No = 1 AND Over_Id = 1 AND Ball_Id = 1",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN Runs_Scored > 3 THEN 1 ELSE 0 END) FROM Batsman_Scored WHERE 335989 < Match_Id < 337000 AND Innings_No = 1 AND Over_Id = 1 AND Ball_Id = 1",
"index": 970,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBetween match no. 335989 and 337000 refers to 335989 < Match_Id < 337000; batsman score more than 3 runs during over no. 1, ball no. 1, and inning no. 1 of the matches refers to Runs_Scored > 3 and Over_Id = 1 and Ball_Id = 1 and Innings_No = 1\nBetween match nos. 335989 and 337000, how many times did a batsman score more than 3 runs during over no. 1, ball no. 1, and inning no. 1 of the matches?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['Kingsmead', 'M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndate of the matches refers to Match_Date; held in Kingsmead refers to Venue_Name = 'Kingsmead'\nGive me the match ID and date of the matches that were held in Kingsmead for three consecutive days.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Match_Id, T1.Match_Date FROM `Match` AS T1 INNER JOIN Venue AS T2 ON T1.Venue_Id = T2.Venue_Id WHERE T2.Venue_Name = 'Kingsmead'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T1.Match_Id, T1.Match_Date FROM `Match` AS T1 INNER JOIN Venue AS T2 ON T1.Venue_Id = T2.Venue_Id WHERE T2.Venue_Name = 'Kingsmead'",
"index": 971,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['Kingsmead', 'M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndate of the matches refers to Match_Date; held in Kingsmead refers to Venue_Name = 'Kingsmead'\nGive me the match ID and date of the matches that were held in Kingsmead for three consecutive days.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2009-05-09', '2009-05-08', '2009-05-07', '2009-05-06', '2009-05-04', '2009-05-03']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['MA Chidambaram Stadium', 'M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMA Chidambaram Stadium refers to Venue_Name = 'MA Chidambaram Stadium' ; from 5/9/2009 to 8/8/2011 refers to Match_Date between '2009-05-09' and '2011-08-08'\nHow many times did the matches were held in MA Chidambaram Stadium from 5/9/2009 to 8/8/2011?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(CASE WHEN Venue_Name = 'MA Chidambaram Stadium' THEN 1 ELSE 0 END) FROM `Match` AS T1 INNER JOIN Venue AS T2 ON T1.Venue_Id = T2.Venue_Id WHERE Match_Date BETWEEN '2009-05-09' AND '2011-08-08'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN Venue_Name = 'MA Chidambaram Stadium' THEN 1 ELSE 0 END) FROM `Match` AS T1 INNER JOIN Venue AS T2 ON T1.Venue_Id = T2.Venue_Id WHERE Match_Date BETWEEN '2009-05-09' AND '2011-08-08'",
"index": 972,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2009-05-09', '2009-05-08', '2009-05-07', '2009-05-06', '2009-05-04', '2009-05-03']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['MA Chidambaram Stadium', 'M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMA Chidambaram Stadium refers to Venue_Name = 'MA Chidambaram Stadium' ; from 5/9/2009 to 8/8/2011 refers to Match_Date between '2009-05-09' and '2011-08-08'\nHow many times did the matches were held in MA Chidambaram Stadium from 5/9/2009 to 8/8/2011?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nID 336005 match refers to Match_Id = '336005'; venue refers to Venue_Name; city refers to City_Name\nWhere was the ID 336005 match held? Please give me the venue and the city.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.Venue_Name, T3.City_Name FROM `Match` AS T1 INNER JOIN Venue AS T2 ON T1.Venue_Id = T2.Venue_Id INNER JOIN City AS T3 ON T2.City_Id = T3.City_Id WHERE T1.Match_Id = '336005'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T2.Venue_Name, T3.City_Name FROM `Match` AS T1 INNER JOIN Venue AS T2 ON T1.Venue_Id = T2.Venue_Id INNER JOIN City AS T3 ON T2.City_Id = T3.City_Id WHERE T1.Match_Id = '336005'",
"index": 973,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nID 336005 match refers to Match_Id = '336005'; venue refers to Venue_Name; city refers to City_Name\nWhere was the ID 336005 match held? Please give me the venue and the city.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['V Kohli', 'T Kohli', 'SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTally the match IDs in which V Kohli is the \"Man of the Match\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Match_Id FROM `Match` AS T1 INNER JOIN Player AS T2 ON T1.Man_of_the_Match = T2.Player_Id WHERE T2.Player_Name = 'V Kohli'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T1.Match_Id FROM `Match` AS T1 INNER JOIN Player AS T2 ON T1.Man_of_the_Match = T2.Player_Id WHERE T2.Player_Name = 'V Kohli'",
"index": 974,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['V Kohli', 'T Kohli', 'SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTally the match IDs in which V Kohli is the \"Man of the Match\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWho refers to Player_Name;\nWho among the players won both \"Man of the Series\" and \"Orange Cap\" in the same 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 T1.Player_Name FROM Player AS T1 INNER JOIN Season AS T2 ON T1.Player_Id = T2.Man_of_the_Series = T2.Orange_Cap",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T1.Player_Name FROM Player AS T1 INNER JOIN Season AS T2 ON T1.Player_Id = T2.Man_of_the_Series = T2.Orange_Cap",
"index": 975,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Player', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWho refers to Player_Name;\nWho among the players won both \"Man of the Series\" and \"Orange Cap\" in the same 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 `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['England', 'India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEnglish umpires refers to Country_Name = 'England'\nWrite down the player names and IDs of the English umpires.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Umpire_Name, T1.Umpire_Id FROM Umpire AS T1 INNER JOIN Country AS T2 ON T1.Umpire_Country = T2.Country_Id WHERE T2.Country_Name = 'England'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T1.Umpire_Name, T1.Umpire_Id FROM Umpire AS T1 INNER JOIN Country AS T2 ON T1.Umpire_Country = T2.Country_Id WHERE T2.Country_Name = 'England'",
"index": 976,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['England', 'India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEnglish umpires refers to Country_Name = 'England'\nWrite down the player names and IDs of the English umpires.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nend of 16 overs refers to count(Toss_Name = 'field' ) = 16; run rate = divide(count(Runs_Scored) when Toss_Name = 'bat', sum(Over_Id)when Toss_Name = 'field'); name refers to Player_Name\nCompute the run rate at the end of 16 overs of the match ID 335999. Please include the name of the \"Man of_the Match\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(COUNT(CASE WHEN T1.Toss_Name = 'bat' THEN T3.Runs_Scored ELSE NULL END) AS REAL) / SUM(CASE WHEN T1.Toss_Name = 'field' THEN 1 ELSE 0 END) FROM Toss_Decision AS T1 INNER JOIN Match AS T2 ON T1.Toss_Id = T2.Toss_Decide INNER JOIN Batsman_Scored AS T3 ON T2.Match_Id = T3.Match_Id WHERE T2.Match_Id = 335987 AND T2.Match_Date = '2008-04-18' GROUP BY T3.Over_Id HAVING COUNT(T1.Toss_Name = 'field') = 16",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN T1.Toss_Name = 'bat' THEN T3.Runs_Scored ELSE NULL END) AS REAL) / SUM(CASE WHEN T1.Toss_Name = 'field' THEN 1 ELSE 0 END) FROM Toss_Decision AS T1 INNER JOIN Match AS T2 ON T1.Toss_Id = T2.Toss_Decide INNER JOIN Batsman_Scored AS T3 ON T2.Match_Id = T3.Match_Id WHERE T2.Match_Id = 335987 AND T2.Match_Date = '2008-04-18' GROUP BY T3.Over_Id HAVING COUNT(T1.Toss_Name = 'field') = 16",
"index": 977,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nend of 16 overs refers to count(Toss_Name = 'field' ) = 16; run rate = divide(count(Runs_Scored) when Toss_Name = 'bat', sum(Over_Id)when Toss_Name = 'field'); name refers to Player_Name\nCompute the run rate at the end of 16 overs of the match ID 335999. Please include the name of the \"Man of_the Match\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nid of the team refers to Team_Id; highest number of matches won refers to max(count(Match_Winner))\nWhat is the id of the team with the highest number of matches 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 Match_Id FROM `Match` ORDER BY Match_Winner DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT Match_Id FROM `Match` ORDER BY Match_Winner DESC LIMIT 1",
"index": 978,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nid of the team refers to Team_Id; highest number of matches won refers to max(count(Match_Winner))\nWhat is the id of the team with the highest number of matches 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 Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker integer, -- example: [1, 6]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndate of the match refers to Match_Date; highest wager refers to max(Win_Margin)\nWhat is the date of the match that has the highest wager on the final result of a game?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT Match_Date FROM `Match` ORDER BY Win_Margin DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT Match_Date FROM `Match` ORDER BY Win_Margin DESC LIMIT 1",
"index": 979,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker integer, -- example: [1, 6]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndate of the match refers to Match_Date; highest wager refers to max(Win_Margin)\nWhat is the date of the match that has the highest wager on the final result of a game?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the team refers to Team_Name; won the first ever match refers to Match_Winner where max(Match_Date)\nWhat is the name of the team that won the first ever match?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Team_Name FROM team AS T1 INNER JOIN Match AS T2 ON T1.Team_Id = T2.Match_Winner WHERE T2.Season_Id = 1 ORDER BY T2.Match_Date LIMIT 1",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T1.Team_Name FROM team AS T1 INNER JOIN Match AS T2 ON T1.Team_Id = T2.Match_Winner WHERE T2.Season_Id = 1 ORDER BY T2.Match_Date LIMIT 1",
"index": 980,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the team refers to Team_Name; won the first ever match refers to Match_Winner where max(Match_Date)\nWhat is the name of the team that won the first ever match?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['England', 'India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom England refers to Country_Name = 'England'\nList the names of all the umpires from England.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Umpire_Name FROM Umpire AS T1 INNER JOIN country AS T2 ON T2.Country_Id = T1.Umpire_Country WHERE T2.Country_Name = 'England'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T1.Umpire_Name FROM Umpire AS T1 INNER JOIN country AS T2 ON T2.Country_Id = T1.Umpire_Country WHERE T2.Country_Name = 'England'",
"index": 981,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['England', 'India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom England refers to Country_Name = 'England'\nList the names of all the umpires from England.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWho refers to Player_Name; youngest player to have won the Purple Cap refers to min(subtract(Season_Year, DOB))\nWho is the youngest player to have won the Purple Cap?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Player_Name FROM Player AS T1 INNER JOIN Season AS T2 ON T1.Player_Id = T2.Purple_Cap ORDER BY T2.Season_Year - SUBSTR(T1.DOB, 1, 4) LIMIT 1",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T1.Player_Name FROM Player AS T1 INNER JOIN Season AS T2 ON T1.Player_Id = T2.Purple_Cap ORDER BY T2.Season_Year - SUBSTR(T1.DOB, 1, 4) LIMIT 1",
"index": 982,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWho refers to Player_Name; youngest player to have won the Purple Cap refers to min(subtract(Season_Year, DOB))\nWho is the youngest player to have won the Purple Cap?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many overs were there in each innings of match ID \"336011\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Innings_No = 1 THEN 1 ELSE 0 END) AS IN1 , SUM(CASE WHEN Innings_No = 2 THEN 1 ELSE 0 END) AS IN2 FROM Ball_by_Ball WHERE Match_Id = 336011",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN Innings_No = 1 THEN 1 ELSE 0 END) AS IN1 , SUM(CASE WHEN Innings_No = 2 THEN 1 ELSE 0 END) AS IN2 FROM Ball_by_Ball WHERE Match_Id = 336011",
"index": 983,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many overs were there in each innings of match ID \"336011\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2012 refers to Match_Date like '2012%'; win rate refers to DIVIDE(COUNT(Toss_Winner = Match_Winner), COUNT(Match_Date like '2012%'))\nCalculate the win rate of the toss-winners in 2012.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN Toss_Winner = Match_Winner THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN Match_Date LIKE '2012%' THEN 1 ELSE 0 END) FROM `Match`",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN Toss_Winner = Match_Winner THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN Match_Date LIKE '2012%' THEN 1 ELSE 0 END) FROM `Match`",
"index": 984,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2012 refers to Match_Date like '2012%'; win rate refers to DIVIDE(COUNT(Toss_Winner = Match_Winner), COUNT(Match_Date like '2012%'))\nCalculate the win rate of the toss-winners in 2012.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['Mohammad Hafeez', 'SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMohammad Hafeez refers to Player_Name = 'Mohammad Hafeez';\nHow many matches did Mohammad Hafeez 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 SUM(CASE WHEN T2.Player_Name = 'Mohammad Hafeez' THEN 1 ELSE 0 END) FROM Player_Match AS T1 INNER JOIN Player AS T2 ON T1.Player_Id = T2.Player_Id",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T2.Player_Name = 'Mohammad Hafeez' THEN 1 ELSE 0 END) FROM Player_Match AS T1 INNER JOIN Player AS T2 ON T1.Player_Id = T2.Player_Id",
"index": 985,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['Mohammad Hafeez', 'SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMohammad Hafeez refers to Player_Name = 'Mohammad Hafeez';\nHow many matches did Mohammad Hafeez 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 Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Mumbai Indians', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplayed in 2009 Match_Date like '2009%'; Mumbai Indians\" team refers to Team_Name = 'Mumbai Indians'; percent of the matches did they win refers to DIVIDE(COUNT(Match_Winner = Team_Id), COUNT(Match_Id))\nAmong the\" Mumbai Indians\" team that played in 2009, how many percent of the matches did they win?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T1.Match_Winner = T2.Team_Id THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Match_Id) FROM `Match` AS T1 INNER JOIN Team AS T2 ON T1.Team_1 = T2.Team_Id OR T1.Team_2 = T2.Team_Id WHERE T2.Team_Name = 'Mumbai Indians' AND T1.Match_Date LIKE '2009%'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T1.Match_Winner = T2.Team_Id THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Match_Id) FROM `Match` AS T1 INNER JOIN Team AS T2 ON T1.Team_1 = T2.Team_Id OR T1.Team_2 = T2.Team_Id WHERE T2.Team_Name = 'Mumbai Indians' AND T1.Match_Date LIKE '2009%'",
"index": 986,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Mumbai Indians', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplayed in 2009 Match_Date like '2009%'; Mumbai Indians\" team refers to Team_Name = 'Mumbai Indians'; percent of the matches did they win refers to DIVIDE(COUNT(Match_Winner = Team_Id), COUNT(Match_Id))\nAmong the\" Mumbai Indians\" team that played in 2009, how many percent of the matches did they win?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['New Zealand', 'India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNew Zealand refers to Country_Name = 'New Zealand'; ID of the umpire refers to Umpire_Id; name of the umpire refers to Umpire_Name\nList the IDs and names of the umpires from New Zealand.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Umpire_Id, T1.Umpire_Name FROM Umpire AS T1 INNER JOIN Country AS T2 ON T1.Umpire_Country = T2.Country_Id WHERE T2.Country_Name = 'New Zealand'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T1.Umpire_Id, T1.Umpire_Name FROM Umpire AS T1 INNER JOIN Country AS T2 ON T1.Umpire_Country = T2.Country_Id WHERE T2.Country_Name = 'New Zealand'",
"index": 987,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['New Zealand', 'India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNew Zealand refers to Country_Name = 'New Zealand'; ID of the umpire refers to Umpire_Id; name of the umpire refers to Umpire_Name\nList the IDs and names of the umpires from New Zealand.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['CaptainKeeper', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Pune', 'Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Rising Pune Supergiants', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncaptain-keeper refers to Role_Desc = 'CaptainKeeper'; Rising Pune Supergiants refers to Role_Desc = 'CaptainKeeper'\nWho was the captain-keeper of Rising Pune Supergiants?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Player_Name FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T1.Player_Id = T2.Player_Id INNER JOIN Team AS T3 ON T2.Team_Id = T3.Team_Id INNER JOIN Rolee AS T4 ON T2.Role_Id = T4.Role_Id WHERE T3.Team_Name = 'Rising Pune Supergiants' AND T4.Role_Desc = 'CaptainKeeper' GROUP BY T1.Player_Name",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T1.Player_Name FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T1.Player_Id = T2.Player_Id INNER JOIN Team AS T3 ON T2.Team_Id = T3.Team_Id INNER JOIN Rolee AS T4 ON T2.Role_Id = T4.Role_Id WHERE T3.Team_Name = 'Rising Pune Supergiants' AND T4.Role_Desc = 'CaptainKeeper' GROUP BY T1.Player_Name",
"index": 988,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['CaptainKeeper', 'Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Pune', 'Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Rising Pune Supergiants', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncaptain-keeper refers to Role_Desc = 'CaptainKeeper'; Rising Pune Supergiants refers to Role_Desc = 'CaptainKeeper'\nWho was the captain-keeper of Rising Pune Supergiants?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Sunrisers Hyderabad', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Hyderabad', 'Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSunrisers Hyderabad team refers to Team_Name = 'Sunrisers Hyderabad'; in 2013 refers to Match_Date like '2013%';\nHow many matches did the Sunrisers Hyderabad team win in 2013?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(CASE WHEN Match_Date LIKE '2013%' THEN 1 ELSE 0 END) FROM `Match` AS T1 INNER JOIN Team AS T2 ON T1.Match_Winner = T2.Team_Id WHERE T2.Team_Name = 'Sunrisers Hyderabad'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN Match_Date LIKE '2013%' THEN 1 ELSE 0 END) FROM `Match` AS T1 INNER JOIN Team AS T2 ON T1.Match_Winner = T2.Team_Id WHERE T2.Team_Name = 'Sunrisers Hyderabad'",
"index": 989,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Sunrisers Hyderabad', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Hyderabad', 'Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSunrisers Hyderabad team refers to Team_Name = 'Sunrisers Hyderabad'; in 2013 refers to Match_Date like '2013%';\nHow many matches did the Sunrisers Hyderabad team win in 2013?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['Tie', 'runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nresulted in a tie refers to Win_Type = 'Tie'; in 2015 refers to SUBSTR(Match_Date, 1, 4) = 2015\nName the teams played in a match which resulted in a tie in 2015.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.Team_Name FROM Team AS T1 INNER JOIN Match AS T2 ON T1.Team_Id = T2.Team_1 OR T1.Team_Id = T2.Team_2 INNER JOIN Win_By AS T3 ON T2.Win_Type = T3.Win_Id WHERE SUBSTR(T2.Match_Date, 1, 4) = '2015' AND T3.Win_Type = 'Tie' LIMIT 1",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T1.Team_Name FROM Team AS T1 INNER JOIN Match AS T2 ON T1.Team_Id = T2.Team_1 OR T1.Team_Id = T2.Team_2 INNER JOIN Win_By AS T3 ON T2.Win_Type = T3.Win_Id WHERE SUBSTR(T2.Match_Date, 1, 4) = '2015' AND T3.Win_Type = 'Tie' LIMIT 1",
"index": 990,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['Tie', 'runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nresulted in a tie refers to Win_Type = 'Tie'; in 2015 refers to SUBSTR(Match_Date, 1, 4) = 2015\nName the teams played in a match which resulted in a tie in 2015.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2008 refers to Match_Date like '2008%'\nHow many matches are there in 2008?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(Match_Id) FROM `Match` WHERE Match_Date LIKE '2008%'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT COUNT(Match_Id) FROM `Match` WHERE Match_Date LIKE '2008%'",
"index": 991,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2008 refers to Match_Date like '2008%'\nHow many matches are there in 2008?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['T Kohli', 'V Kohli', 'SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteam of T Kohli refers to player_name = 'T Kohli';\nGive the name of the team of T Kohli in the match ID 335989.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Team_Name FROM Team AS T1 INNER JOIN Player_Match AS T2 ON T1.Team_Id = T2.Team_Id INNER JOIN Player AS T3 ON T2.Player_Id = T3.Player_Id WHERE T2.match_id = 335989 AND T3.player_name = 'T Kohli'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T1.Team_Name FROM Team AS T1 INNER JOIN Player_Match AS T2 ON T1.Team_Id = T2.Team_Id INNER JOIN Player AS T3 ON T2.Player_Id = T3.Player_Id WHERE T2.match_id = 335989 AND T3.player_name = 'T Kohli'",
"index": 992,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['T Kohli', 'V Kohli', 'SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['India', 'South Africa']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteam of T Kohli refers to player_name = 'T Kohli';\nGive the name of the team of T Kohli in the match ID 335989.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['South Africa', 'India']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Centurion', 'Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nvenues are located at Centurion refers to city_name = 'Centurion'; South Africa refers to country_name = 'South Africa'\nHow many venues are located at Centurion, South Africa?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Venue_name) FROM Venue AS T1 INNER JOIN City AS T2 ON T1.City_Id = T2.City_Id INNER JOIN Country AS T3 ON T2.Country_Id = T3.Country_Id WHERE T3.country_name = 'South Africa' AND T2.city_name = 'Centurion'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT COUNT(T1.Venue_name) FROM Venue AS T1 INNER JOIN City AS T2 ON T1.City_Id = T2.City_Id INNER JOIN Country AS T3 ON T2.Country_Id = T3.Country_Id WHERE T3.country_name = 'South Africa' AND T2.city_name = 'Centurion'",
"index": 993,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n Country_Name text, -- example: ['South Africa', 'India']\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Centurion', 'Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nvenues are located at Centurion refers to city_name = 'Centurion'; South Africa refers to country_name = 'South Africa'\nHow many venues are located at Centurion, South Africa?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Delhi Daredevils', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDelhi Daredevils refers to team_name = 'Delhi Daredevils'; in 2014 refers to Match_Date contains '2014';\nAmong the matches of Delhi Daredevils in 2014, how many won matches are there?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T1.Match_Winner) FROM `Match` AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Team_1 OR T2.Team_Id = T1.Team_2 WHERE T2.team_name = 'Delhi Daredevils' AND T1.Match_Date LIKE '2014%'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT COUNT(T1.Match_Winner) FROM `Match` AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Team_1 OR T2.Team_Id = T1.Team_2 WHERE T2.team_name = 'Delhi Daredevils' AND T1.Match_Date LIKE '2014%'",
"index": 994,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Delhi Daredevils', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDelhi Daredevils refers to team_name = 'Delhi Daredevils'; in 2014 refers to Match_Date contains '2014';\nAmong the matches of Delhi Daredevils in 2014, how many won matches are there?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Royal Challengers Bangalore', 'Kolkata Knight Riders']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRoyal Challengers Bangalore refers to team_name = 'Royal Challengers Bangalore'; highest winning margin refers to MAX(win_margin)\nAmong the matches played by Royal Challengers Bangalore, what is the match ID of the match with the highest winning margin?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.match_id FROM Team AS T1 INNER JOIN Match AS T2 ON T1.team_id = T2.match_winner WHERE T1.team_name = 'Royal Challengers Bangalore' AND T2.match_date LIKE '2012%' ORDER BY T2.win_margin DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T2.match_id FROM Team AS T1 INNER JOIN Match AS T2 ON T1.team_id = T2.match_winner WHERE T1.team_name = 'Royal Challengers Bangalore' AND T2.match_date LIKE '2012%' ORDER BY T2.win_margin DESC LIMIT 1",
"index": 995,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n Country_id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Extra_Runs integer, -- example: [1, 4]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Royal Challengers Bangalore', 'Kolkata Knight Riders']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Name text, -- example: ['Asad Rauf', 'MR Benson']\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRoyal Challengers Bangalore refers to team_name = 'Royal Challengers Bangalore'; highest winning margin refers to MAX(win_margin)\nAmong the matches played by Royal Challengers Bangalore, what is the match ID of the match with the highest winning margin?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['K Goel', 'SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nK Goel refers to Player_Name = 'K Goel'; played as a player only refers to Role_Id = 3\nHow many times did K Goel played as a player only?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Match_Id) FROM Player_Match AS T1 INNER JOIN Player AS T2 ON T1.Player_Id = T2.Player_Id INNER JOIN Rolee AS T3 ON T1.Role_Id = T3.Role_Id WHERE T2.Player_Name = 'K Goel' AND T3.Role_Id = 3",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT COUNT(T1.Match_Id) FROM Player_Match AS T1 INNER JOIN Player AS T2 ON T1.Player_Id = T2.Player_Id INNER JOIN Rolee AS T3 ON T1.Role_Id = T3.Role_Id WHERE T2.Player_Name = 'K Goel' AND T3.Role_Id = 3",
"index": 996,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['K Goel', 'SC Ganguly', 'BB McCullum']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Non_Striker integer, -- example: [2, 7]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nK Goel refers to Player_Name = 'K Goel'; played as a player only refers to Role_Id = 3\nHow many times did K Goel played as a player only?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlosing team's name refers to Team_Id NOT in \"match_winner\" column\nProvide the losing team's name in the match ID 336039.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT Team_Name FROM Team WHERE Team_Id = ( SELECT CASE WHEN Team_1 = Match_Winner THEN Team_2 ELSE Team_1 END FROM Match WHERE match_id = 336039 )",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT Team_Name FROM Team WHERE Team_Id = ( SELECT CASE WHEN Team_1 = Match_Winner THEN Team_2 ELSE Team_1 END FROM Match WHERE match_id = 336039 )",
"index": 997,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n Win_Type text, -- winning type, example: ['runs', 'wickets']\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Runs_Scored integer, -- example: [0, 1]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlosing team's name refers to Team_Id NOT in \"match_winner\" column\nProvide the losing team's name in the match ID 336039.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlowest winning margin refers to MIN(win_margin); team name refers to team_name; second team refers to team_2\nWhat is the second team's name in the match with the lowest winning margin?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.team_name FROM Team AS T1 INNER JOIN Match AS T2 ON T1.team_id = T2.team_2 ORDER BY T2.win_margin LIMIT 1",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T1.team_name FROM Team AS T1 INNER JOIN Match AS T2 ON T1.team_id = T2.team_2 ORDER BY T2.win_margin LIMIT 1",
"index": 998,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n Role_Desc text, -- role description, example: ['Captain', 'Keeper']\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Win_Margin integer, -- winning margin, example: [140, 33]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n Batting_hand text, -- example: ['Left-hand bat', 'Right-hand bat']\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Team_Bowling integer, -- example: [2, 1]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n Toss_Name text, -- example: ['field', 'bat']\n PRIMARY KEY (Toss_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlowest winning margin refers to MIN(win_margin); team name refers to team_name; second team refers to team_2\nWhat is the second team's name in the match with the lowest winning margin?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Mumbai', 'Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Mumbai Indians', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2013 refers to Match_Date like '2013%'; winning of the team \"Mumbai Indians\" refers to Match_Winner = 7; percentage refers to DIVIDE(COUNT(Match_Winner = 7), COUNT(Match_Winner))\nAmong the matches in 2013, what is the percentage of winning of the team \"Mumbai Indians\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T2.Match_Winner = 7 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.Match_Winner) FROM Team AS T1 INNER JOIN Match AS T2 ON T1.Team_Id = T2.Match_Winner WHERE T2.Match_Date LIKE '2013%'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T2.Match_Winner = 7 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.Match_Winner) FROM Team AS T1 INNER JOIN Match AS T2 ON T1.Team_Id = T2.Match_Winner WHERE T2.Match_Date LIKE '2013%'",
"index": 999,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Player_Match (\n Match_Id integer, -- example: [335987, 335988]\n Player_Id integer, -- example: [1, 2]\n Role_Id integer, -- example: [1, 3]\n Team_Id integer, -- example: [1, 2]\n PRIMARY KEY (Match_Id, Player_Id, Role_Id),\n CONSTRAINT fk_player_match_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_player_match_player_id FOREIGN KEY (Player_Id) REFERENCES Player (Player_Id),\n CONSTRAINT fk_player_match_role_id FOREIGN KEY (Role_Id) REFERENCES Rolee (Role_Id),\n CONSTRAINT fk_player_match_team_id FOREIGN KEY (Team_Id) REFERENCES Team (Team_Id)\n);\n\nCREATE TABLE Extra_Runs (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Extra_Type_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_extra_runs_extra_type_id FOREIGN KEY (Extra_Type_Id) REFERENCES Extra_Type (Extra_Id)\n);\n\nCREATE TABLE Outcome (\n Outcome_Id integer, -- example: [1, 2]\n PRIMARY KEY (Outcome_Id)\n);\n\nCREATE TABLE Batsman_Scored (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_batsman_scored_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Country (\n Country_Id integer, -- example: [1, 2]\n PRIMARY KEY (Country_Id)\n);\n\nCREATE TABLE City (\n City_Id integer, -- example: [1, 2]\n City_Name text, -- example: ['Mumbai', 'Bangalore', 'Chandigarh']\n PRIMARY KEY (City_Id)\n);\n\nCREATE TABLE Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_Id)\n);\n\nCREATE TABLE Wicket_Taken (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [2, 3]\n Ball_Id integer, -- example: [1, 2]\n Player_Out integer, -- example: [6, 8]\n Kind_Out integer, -- example: [2, 1]\n Fielders integer, -- example: [83, 9]\n Innings_No integer, -- innings number, example: [2, 1]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_wicket_taken_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id),\n CONSTRAINT fk_wicket_taken_player_out FOREIGN KEY (Player_Out) REFERENCES Player (Player_Id),\n CONSTRAINT fk_wicket_taken_kind_out FOREIGN KEY (Kind_Out) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_wicket_taken_fielders FOREIGN KEY (Fielders) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Rolee (\n Role_Id integer, -- example: [1, 2]\n PRIMARY KEY (Role_Id)\n);\n\nCREATE TABLE Out_Type (\n Out_Id integer, -- example: [1, 2]\n Out_Name text, -- example: ['caught', 'bowled']\n PRIMARY KEY (Out_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n DOB date, -- date of birth, example: ['1972-07-08', '1981-09-27']\n Batting_hand integer, -- example: [1, 2]\n Bowling_skill integer, -- example: [1, 2]\n Country_Name integer, -- example: [1, 4]\n PRIMARY KEY (Player_Id),\n CONSTRAINT fk_player_batting_hand FOREIGN KEY (Batting_hand) REFERENCES Batting_Style (Batting_Id),\n CONSTRAINT fk_player_bowling_skill FOREIGN KEY (Bowling_skill) REFERENCES Bowling_Style (Bowling_Id),\n CONSTRAINT fk_player_country_name FOREIGN KEY (Country_Name) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Bowling_Style (\n Bowling_Id integer, -- example: [1, 2]\n Bowling_skill text, -- example: ['Right-arm medium', 'Right-arm offbreak']\n PRIMARY KEY (Bowling_Id)\n);\n\nCREATE TABLE Extra_Type (\n Extra_Id integer, -- example: [1, 2]\n Extra_Name text, -- example: ['legbyes', 'wides']\n PRIMARY KEY (Extra_Id)\n);\n\nCREATE TABLE `Match` (\n Match_Id integer, -- example: [335987, 335988]\n Team_1 integer, -- example: [2, 4]\n Team_2 integer, -- example: [1, 3]\n Match_Date date, -- example: ['2008-04-18', '2008-04-19']\n Season_Id integer, -- example: [1, 2]\n Venue_Id integer, -- example: [1, 2]\n Toss_Winner integer, -- example: [2, 3]\n Toss_Decide integer, -- example: [1, 2]\n Win_Type integer, -- winning type, example: [1, 2]\n Outcome_type integer, -- example: [1, 3]\n Match_Winner integer, -- example: [1, 3]\n Man_of_the_Match integer, -- example: [2, 19]\n PRIMARY KEY (Match_Id),\n CONSTRAINT fk_match_team_1 FOREIGN KEY (Team_1) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_team_2 FOREIGN KEY (Team_2) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_season_id FOREIGN KEY (Season_Id) REFERENCES Season (Season_Id),\n CONSTRAINT fk_match_venue_id FOREIGN KEY (Venue_Id) REFERENCES Venue (Venue_Id),\n CONSTRAINT fk_match_toss_winner FOREIGN KEY (Toss_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_toss_decide FOREIGN KEY (Toss_Decide) REFERENCES Toss_Decision (Toss_Id),\n CONSTRAINT fk_match_win_type FOREIGN KEY (Win_Type) REFERENCES Win_By (Win_Id),\n CONSTRAINT fk_match_outcome_type FOREIGN KEY (Outcome_type) REFERENCES Out_Type (Out_Id),\n CONSTRAINT fk_match_match_winner FOREIGN KEY (Match_Winner) REFERENCES Team (Team_Id),\n CONSTRAINT fk_match_man_of_the_match FOREIGN KEY (Man_of_the_Match) REFERENCES Player (Player_Id)\n);\n\nCREATE TABLE Team (\n Team_Id integer, -- example: [1, 2]\n Team_Name text, -- example: ['Mumbai Indians', 'Kolkata Knight Riders', 'Royal Challengers Bangalore']\n PRIMARY KEY (Team_Id)\n);\n\nCREATE TABLE Ball_by_Ball (\n Match_Id integer, -- example: [335987, 335988]\n Over_Id integer, -- example: [1, 2]\n Ball_Id integer, -- example: [1, 2]\n Innings_No integer, -- innings number, example: [1, 2]\n Team_Batting integer, -- example: [1, 2]\n Striker_Batting_Position integer, -- example: [1, 2]\n Striker integer, -- example: [1, 6]\n Non_Striker integer, -- example: [2, 7]\n Bowler integer, -- example: [14, 106]\n PRIMARY KEY (Match_Id, Over_Id, Ball_Id, Innings_No),\n CONSTRAINT fk_ball_by_ball_match_id FOREIGN KEY (Match_Id) REFERENCES `Match` (Match_Id)\n);\n\nCREATE TABLE Batting_Style (\n Batting_Id integer, -- example: [1, 2]\n PRIMARY KEY (Batting_Id)\n);\n\nCREATE TABLE Umpire (\n Umpire_Id integer, -- example: [1, 2]\n Umpire_Country integer, -- example: [6, 10]\n PRIMARY KEY (Umpire_Id),\n CONSTRAINT fk_umpire_umpire_country FOREIGN KEY (Umpire_Country) REFERENCES Country (Country_Id)\n);\n\nCREATE TABLE Season (\n Season_Id integer, -- example: [1, 2]\n Orange_Cap integer, -- example: [100, 18]\n Purple_Cap integer, -- example: [102, 61]\n Season_Year integer, -- example: [2008, 2009]\n PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Venue (\n Venue_Id integer, -- example: [1, 2]\n Venue_Name text, -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium']\n City_Id integer, -- example: [1, 2]\n PRIMARY KEY (Venue_Id),\n CONSTRAINT fk_venue_city_id FOREIGN KEY (City_Id) REFERENCES City (City_Id)\n);\n\nCREATE TABLE Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2013 refers to Match_Date like '2013%'; winning of the team \"Mumbai Indians\" refers to Match_Winner = 7; percentage refers to DIVIDE(COUNT(Match_Winner = 7), COUNT(Match_Winner))\nAmong the matches in 2013, what is the percentage of winning of the team \"Mumbai Indians\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.