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 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 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 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 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 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 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 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 `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 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 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 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 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 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);\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'; played as a Captain refers to Role_Id = 1; played other roles refers to Role_Id > 1; difference refers to SUBTRACT(COUNT(Role_Id = 1), COUNT(Role_Id > 1))\nWhat is the difference between the number of matches where SC Ganguly played as a Captain and those matches where he played other roles?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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_Id = 1 THEN 1 ELSE 0 END) - SUM(CASE WHEN T3.Role_Id > 1 THEN 1 ELSE 0 END) 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 = 'SC Ganguly'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T3.Role_Id = 1 THEN 1 ELSE 0 END) - SUM(CASE WHEN T3.Role_Id > 1 THEN 1 ELSE 0 END) 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 = 'SC Ganguly'",
"index": 1000,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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 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 `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 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 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 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 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 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);\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'; played as a Captain refers to Role_Id = 1; played other roles refers to Role_Id > 1; difference refers to SUBTRACT(COUNT(Role_Id = 1), COUNT(Role_Id > 1))\nWhat is the difference between the number of matches where SC Ganguly played as a Captain and those matches where he played other roles?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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_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 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 Out_Name text, -- example: ['caught', 'bowled']\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 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 Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_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 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 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in 1970 refers to DOB like '1970%';\nHow many players were born in 1970?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(Player_Name) FROM Player WHERE DOB LIKE '1970%'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT COUNT(Player_Name) FROM Player WHERE DOB LIKE '1970%'",
"index": 1001,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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_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 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 Out_Name text, -- example: ['caught', 'bowled']\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 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 Win_By (\n Win_Id integer, -- winning id, example: [1, 2]\n PRIMARY KEY (Win_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 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 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in 1970 refers to DOB like '1970%';\nHow many players were born in 1970?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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 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 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 (\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 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 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 PRIMARY KEY (Bowling_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 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 Man_of_the_Series integer, -- example: [32, 53]\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 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 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);\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 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 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:\nWhat is the city name of country ID 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 City_Name FROM City WHERE Country_ID = 3",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT City_Name FROM City WHERE Country_ID = 3",
"index": 1002,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 (\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 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 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 PRIMARY KEY (Bowling_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 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 Man_of_the_Series integer, -- example: [32, 53]\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 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 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);\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 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 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:\nWhat is the city name of country ID 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 Extra_Name text, -- example: ['legbyes', 'wides']\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 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 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 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 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: ['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 Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_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 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 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 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 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_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 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);\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'; role refers to Role_Desc\nWhat is the role of SC Ganguly?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Role_Desc 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' GROUP BY T3.Role_Desc",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T3.Role_Desc 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' GROUP BY T3.Role_Desc",
"index": 1003,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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: ['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 Toss_Decision (\n Toss_Id integer, -- example: [1, 2]\n PRIMARY KEY (Toss_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 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 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 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 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_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 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);\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'; role refers to Role_Desc\nWhat is the role of SC Ganguly?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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_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 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 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 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 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 `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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin team 1 refers to Team_Id = 1; name of player refers to Player_Name;\nWhat are the names of players in 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 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 WHERE T3.Team_Id = 1 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 WHERE T3.Team_Id = 1 GROUP BY T1.Player_Name",
"index": 1004,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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_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 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 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 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 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 `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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin team 1 refers to Team_Id = 1; name of player refers to Player_Name;\nWhat are the names of players in 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 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 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 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 Country (\n Country_Id integer, -- example: [1, 2]\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 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 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_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 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplayed as a captain refers to Role_Desc = 'Captain'; in season year 2008 refers Match_Date like '2008%'\nHow many players played as a captain in season year 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(T1.Player_Id) FROM Player_Match AS T1 INNER JOIN Match AS T2 ON T1.Match_Id = T2.Match_Id INNER JOIN Rolee AS T3 ON T1.Role_Id = T3.Role_Id WHERE T3.Role_Desc = 'Captain' AND T2.Match_Date LIKE '2008%'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT COUNT(T1.Player_Id) FROM Player_Match AS T1 INNER JOIN Match AS T2 ON T1.Match_Id = T2.Match_Id INNER JOIN Rolee AS T3 ON T1.Role_Id = T3.Role_Id WHERE T3.Role_Desc = 'Captain' AND T2.Match_Date LIKE '2008%'",
"index": 1005,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 `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 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 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 Country (\n Country_Id integer, -- example: [1, 2]\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 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 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_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 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplayed as a captain refers to Role_Desc = 'Captain'; in season year 2008 refers Match_Date like '2008%'\nHow many players played as a captain in season year 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 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 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 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 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 City (\n City_Id integer, -- example: [1, 2]\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 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 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 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 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_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 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_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntype of match won refers to Win_Type\nWhat type did match ID 336000 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 T2.Win_Type FROM Match AS T1 INNER JOIN Win_By AS T2 ON T1.Win_Type = T2.Win_Id WHERE T1.Match_Id = 336000",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T2.Win_Type FROM Match AS T1 INNER JOIN Win_By AS T2 ON T1.Win_Type = T2.Win_Id WHERE T1.Match_Id = 336000",
"index": 1006,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 City (\n City_Id integer, -- example: [1, 2]\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 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 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 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 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_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 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_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntype of match won refers to Win_Type\nWhat type did match ID 336000 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 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 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: ['SB Joshi', '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 Country_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 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);\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 `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 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 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 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 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 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: ['Player', 'Captain', 'Keeper']\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:\nSB Joshi refers to Player_Name = 'SB Joshi'; where the player come from refers to Country_Name\nWhere did SB Joshi come from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.Country_Name FROM Player AS T1 INNER JOIN Country AS T2 ON T1.Country_Name = T2.Country_ID WHERE T1.Player_Name = 'SB Joshi'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T2.Country_Name FROM Player AS T1 INNER JOIN Country AS T2 ON T1.Country_Name = T2.Country_ID WHERE T1.Player_Name = 'SB Joshi'",
"index": 1007,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 PRIMARY KEY (Season_Id)\n);\n\nCREATE TABLE Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['SB Joshi', '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 Country_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 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);\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 `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 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 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 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 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 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: ['Player', 'Captain', 'Keeper']\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:\nSB Joshi refers to Player_Name = 'SB Joshi'; where the player come from refers to Country_Name\nWhere did SB Joshi come from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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 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 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 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 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_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 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 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: ['Left-arm fast', '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 `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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave left arm fast in bowling skill refers to Bowling_skill = 'Left-arm fast';\nHow many players have left arm fast in bowling 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 COUNT(T1.Player_Id) FROM Player AS T1 INNER JOIN Bowling_Style AS T2 ON T1.Bowling_skill = T2.Bowling_Id WHERE T2.Bowling_skill = 'Left-arm fast'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT COUNT(T1.Player_Id) FROM Player AS T1 INNER JOIN Bowling_Style AS T2 ON T1.Bowling_skill = T2.Bowling_Id WHERE T2.Bowling_skill = 'Left-arm fast'",
"index": 1008,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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_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 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 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: ['Left-arm fast', '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 `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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave left arm fast in bowling skill refers to Bowling_skill = 'Left-arm fast';\nHow many players have left arm fast in bowling 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 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 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 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 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_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 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 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 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_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 Country_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 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 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 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:\nWhat is the outcome type of match ID 392195?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Outcome_Type FROM Match AS T1 INNER JOIN Outcome AS T2 ON T1.Outcome_type = T2.Outcome_Id WHERE T1.Match_Id = '392195'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T2.Outcome_Type FROM Match AS T1 INNER JOIN Outcome AS T2 ON T1.Outcome_type = T2.Outcome_Id WHERE T1.Match_Id = '392195'",
"index": 1009,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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 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 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_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 Country_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 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 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 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:\nWhat is the outcome type of match ID 392195?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 `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 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 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 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_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 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 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 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 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 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 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 Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\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:\nyoungest player refers to MIN(DOB); city refers to City_Name\nWho is the youngest player and which city did he/she come from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.City_Name FROM Player AS T1 INNER JOIN Country AS T2 ON T1.Country_Name = T2.Country_Id INNER JOIN City AS T3 ON T2.Country_Id = T3.Country_Id ORDER BY T1.DOB LIMIT 1",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T3.City_Name FROM Player AS T1 INNER JOIN Country AS T2 ON T1.Country_Name = T2.Country_Id INNER JOIN City AS T3 ON T2.Country_Id = T3.Country_Id ORDER BY T1.DOB LIMIT 1",
"index": 1010,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 `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 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 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 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_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 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 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 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 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 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 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 Outcome (\n Outcome_Id integer, -- example: [1, 2]\n Outcome_Type text, -- example: ['Result', 'No Result']\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:\nyoungest player refers to MIN(DOB); city refers to City_Name\nWho is the youngest player and which city did he/she come from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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 Player (\n Player_Id integer, -- example: [1, 2]\n Player_Name text, -- example: ['R Dravid', '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 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 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_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 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 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 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 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 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 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 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 City (\n City_Id integer, -- example: [1, 2]\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 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:\nR Dravid refers to Player_Name = 'R Dravid'; year born refers to DOB; role refers to Role_Desc\nWhat year was R Dravid born and the role he played?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.DOB, T3.Role_Desc 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 = 'R Dravid' GROUP BY T1.DOB, T3.Role_Desc",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T1.DOB, T3.Role_Desc 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 = 'R Dravid' GROUP BY T1.DOB, T3.Role_Desc",
"index": 1011,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['R Dravid', '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 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 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_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 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 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 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 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 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 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 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 City (\n City_Id integer, -- example: [1, 2]\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 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:\nR Dravid refers to Player_Name = 'R Dravid'; year born refers to DOB; role refers to Role_Desc\nWhat year was R Dravid born and the role he played?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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 PRIMARY KEY (Bowling_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 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 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 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 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: ['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 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 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 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 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 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:\nteam refers to Team_Name\nWhich team won by wickets in match ID 335993?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 INNER JOIN Player_Match AS T3 ON T1.Team_Id = T3.Team_Id INNER JOIN Win_By AS T4 ON T2.Win_Type = T4.Win_Id WHERE T2.Match_Id = '335993' GROUP BY T1.Team_Name",
"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 INNER JOIN Player_Match AS T3 ON T1.Team_Id = T3.Team_Id INNER JOIN Win_By AS T4 ON T2.Win_Type = T4.Win_Id WHERE T2.Match_Id = '335993' GROUP BY T1.Team_Name",
"index": 1012,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 PRIMARY KEY (Bowling_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 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 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 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 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: ['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 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 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 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 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 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:\nteam refers to Team_Name\nWhich team won by wickets in match ID 335993?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 `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 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: ['W Jaffer', '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 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 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_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 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 Team_Batting integer, -- 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 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 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 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 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 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 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:\nW Jaffer refers to Player_name = 'W Jaffer'; in season year 2012 refers to Season_Year = 2012; role refers to Role_Desc\nWhat is the role of W Jaffer in season year 2012?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T4.Role_Desc 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 Rolee AS T4 ON T2.Role_Id = T4.Role_Id INNER JOIN Season AS T5 ON T3.Season_Id = T5.Season_Id WHERE T1.Player_name = 'W Jaffer' AND T5.Season_Year = 2012",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T4.Role_Desc 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 Rolee AS T4 ON T2.Role_Id = T4.Role_Id INNER JOIN Season AS T5 ON T3.Season_Id = T5.Season_Id WHERE T1.Player_name = 'W Jaffer' AND T5.Season_Year = 2012",
"index": 1013,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 `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 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: ['W Jaffer', '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 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 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_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 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 Team_Batting integer, -- 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 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 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 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 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 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 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:\nW Jaffer refers to Player_name = 'W Jaffer'; in season year 2012 refers to Season_Year = 2012; role refers to Role_Desc\nWhat is the role of W Jaffer in season year 2012?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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 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 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 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 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 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 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 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 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 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 `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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nman of the match more than 5 times refers to COUNT(Man_of_the_Match) > 5; in season year 2008 refers to Season_Year = 2008; name of player refers to Player_Name;\nWhat are the names of players who had been man of the match more than 5 times in season year 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 CASE WHEN COUNT(T2.Man_of_the_Match) > 5 THEN T1.Player_Name ELSE 0 END FROM Player AS T1 INNER JOIN Match AS T2 ON T1.Player_Id = T2.Man_of_the_Match INNER JOIN Player_Match AS T3 ON T3.Player_Id = T1.Player_Id INNER JOIN Season AS T4 ON T2.Season_Id = T4.Season_Id WHERE T4.Season_Year = 2008",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT CASE WHEN COUNT(T2.Man_of_the_Match) > 5 THEN T1.Player_Name ELSE 0 END FROM Player AS T1 INNER JOIN Match AS T2 ON T1.Player_Id = T2.Man_of_the_Match INNER JOIN Player_Match AS T3 ON T3.Player_Id = T1.Player_Id INNER JOIN Season AS T4 ON T2.Season_Id = T4.Season_Id WHERE T4.Season_Year = 2008",
"index": 1014,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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 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 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 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 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 `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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nman of the match more than 5 times refers to COUNT(Man_of_the_Match) > 5; in season year 2008 refers to Season_Year = 2008; name of player refers to Player_Name;\nWhat are the names of players who had been man of the match more than 5 times in season year 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 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 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 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 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_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 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 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 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 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 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 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 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 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 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 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:\nIndian players refers to Country_Name = 'India'; born between 1975 and 1985 refers to strftime('%Y',T1.DOB) between '1975' and '1985'; average refers to DIVIDE(COUNT(Country_Name = 'India'), COUNT(Player_Id))\nWhat is the average of Indian players that were born between 1975 and 1985 among all 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 T2.Country_Name = 'India' THEN 1 ELSE 0 END) AS REAL) / COUNT(T1.Player_Id) FROM Player AS T1 INNER JOIN Country AS T2 ON T1.Country_Name = T2.Country_ID WHERE strftime('%Y', T1.DOB) BETWEEN '1975' AND '1985'",
"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) / COUNT(T1.Player_Id) FROM Player AS T1 INNER JOIN Country AS T2 ON T1.Country_Name = T2.Country_ID WHERE strftime('%Y', T1.DOB) BETWEEN '1975' AND '1985'",
"index": 1015,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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_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 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 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 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 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 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 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 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 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 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 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:\nIndian players refers to Country_Name = 'India'; born between 1975 and 1985 refers to strftime('%Y',T1.DOB) between '1975' and '1985'; average refers to DIVIDE(COUNT(Country_Name = 'India'), COUNT(Player_Id))\nWhat is the average of Indian players that were born between 1975 and 1985 among all players?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Country (\n 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 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);\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 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 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 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 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 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 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 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 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 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_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:\nhave 7 points of winning margin refers to win_margin = 7;\nHow many matches have 7 points of 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 COUNT(Match_Id) FROM Match WHERE win_margin = 7",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT COUNT(Match_Id) FROM Match WHERE win_margin = 7",
"index": 1016,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 `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 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 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 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 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 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 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 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 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 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 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 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_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:\nhave 7 points of winning margin refers to win_margin = 7;\nHow many matches have 7 points of 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn between 1970 to 1975 refers to strftime('%Y',DOB) between '1970' and '1975'\nWhat is the total number of players born between 1970 to 1975?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(Player_Id) FROM Player WHERE strftime('%Y', DOB) BETWEEN '1970' AND '1975'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT COUNT(Player_Id) FROM Player WHERE strftime('%Y', DOB) BETWEEN '1970' AND '1975'",
"index": 1017,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn between 1970 to 1975 refers to strftime('%Y',DOB) between '1970' and '1975'\nWhat is the total number of players born between 1970 to 1975?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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 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 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 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 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 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 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 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 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 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 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 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 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 Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\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; winning team refers to match_winner\nGive the match's venue and winning team for the match ID 392194.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Venue_Name, T3.Team_Name FROM Venue AS T1 INNER JOIN Match AS T2 ON T1.venue_id = T2.venue_id INNER JOIN Team AS T3 ON T2.match_winner = T3.Team_Id WHERE T2.Match_Id = 392194",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT T1.Venue_Name, T3.Team_Name FROM Venue AS T1 INNER JOIN Match AS T2 ON T1.venue_id = T2.venue_id INNER JOIN Team AS T3 ON T2.match_winner = T3.Team_Id WHERE T2.Match_Id = 392194",
"index": 1018,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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 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 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 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 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 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 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 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 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 Season (\n Season_Id integer, -- example: [1, 2]\n Man_of_the_Series integer, -- example: [32, 53]\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; winning team refers to match_winner\nGive the match's venue and winning team for the match ID 392194.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 `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 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 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 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 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 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: ['Delhi Daredevils', '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 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 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 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 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);\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 2009 refers to Match_Date = '2009%'; won by wickets refers to Win_Type = 'wickets'; percentage refers to DIVIDE(COUNT(Win_Type = 'wickets'), COUNT(Win_Type))\nAmong the matches of Delhi Daredevils in 2009, what is the percentage of their matches won by wickets?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 T3.Win_Type = 'wickets' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T3.Win_Type) FROM Team AS T1 INNER JOIN Match AS T2 ON T1.Team_Id = T2.Match_Winner INNER JOIN Win_By AS T3 ON T2.Win_Type = T3.Win_Id WHERE T1.Team_Name = 'Delhi Daredevils'",
"style": "rule"
} | {
"db_id": "soccer_2016.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T3.Win_Type = 'wickets' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T3.Win_Type) FROM Team AS T1 INNER JOIN Match AS T2 ON T1.Team_Id = T2.Match_Winner INNER JOIN Win_By AS T3 ON T2.Win_Type = T3.Win_Id WHERE T1.Team_Name = 'Delhi Daredevils'",
"index": 1019,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 `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 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 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 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 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 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: ['Delhi Daredevils', '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 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 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 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 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);\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 2009 refers to Match_Date = '2009%'; won by wickets refers to Win_Type = 'wickets'; percentage refers to DIVIDE(COUNT(Win_Type = 'wickets'), COUNT(Win_Type))\nAmong the matches of Delhi Daredevils in 2009, what is the percentage of their matches won by wickets?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE torrents (\n totalSnatched integer, -- example: [239, 156]\n artist text, -- example: ['blowfly', 'time', 'grandmaster flash & the furious five', 'ron hunt & ronnie g & the sm crew']\n groupYear integer, -- example: [1979, 1980]\n releaseType text, -- example: ['album', 'single']\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n PRIMARY KEY (`index`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nblowfly is an artist; groupYear = 1980; album refers to releaseType; downloaded refers to totalSnatched;\nHow many times was the album released by blowfly in 1980 downloaded?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT totalSnatched FROM torrents WHERE artist LIKE 'blowfly' AND groupYear = 1980",
"style": "rule"
} | {
"db_id": "music_tracker.sqlite",
"gt_sql": "SELECT totalSnatched FROM torrents WHERE artist LIKE 'blowfly' AND groupYear = 1980",
"index": 1020,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE torrents (\n totalSnatched integer, -- example: [239, 156]\n artist text, -- example: ['blowfly', 'time', 'grandmaster flash & the furious five', 'ron hunt & ronnie g & the sm crew']\n groupYear integer, -- example: [1979, 1980]\n releaseType text, -- example: ['album', 'single']\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n PRIMARY KEY (`index`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nblowfly is an artist; groupYear = 1980; album refers to releaseType; downloaded refers to totalSnatched;\nHow many times was the album released by blowfly in 1980 downloaded?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['download', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\n\nCREATE TABLE torrents (\n groupName text, -- example: ['downloads', 'what', 'superappin'', 'spiderap / a corona jam']\n totalSnatched integer, -- example: [239, 156]\n artist text, -- example: ['grandmaster flash & the furious five', 'ron hunt & ronnie g & the sm crew']\n groupYear integer, -- example: [1979, 1980]\n releaseType text, -- example: ['single', 'album']\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest amount of downloads refers to MAX(totalSnatched);\nWhat are the top 5 tags with the highest amount of downloads?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.tag FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T1.releaseType = 'album' ORDER BY T1.totalSnatched DESC LIMIT 5",
"style": "rule"
} | {
"db_id": "music_tracker.sqlite",
"gt_sql": "SELECT T2.tag FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T1.releaseType = 'album' ORDER BY T1.totalSnatched DESC LIMIT 5",
"index": 1021,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['download', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\n\nCREATE TABLE torrents (\n groupName text, -- example: ['downloads', 'what', 'superappin'', 'spiderap / a corona jam']\n totalSnatched integer, -- example: [239, 156]\n artist text, -- example: ['grandmaster flash & the furious five', 'ron hunt & ronnie g & the sm crew']\n groupYear integer, -- example: [1979, 1980]\n releaseType text, -- example: ['single', 'album']\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest amount of downloads refers to MAX(totalSnatched);\nWhat are the top 5 tags with the highest amount of downloads?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['single', 'other', 'funk', '1970s']\n PRIMARY KEY (`index`)\n);\n\nCREATE TABLE torrents (\n groupName text, -- example: ['the release', 'the single', 'released', 'in time', 'release', 'funk']\n totalSnatched integer, -- example: [239, 156]\n groupYear integer, -- example: [1979, 1980]\n releaseType text, -- example: ['single', 'album']\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrelease title of single refers to groupName where releaseType = 'single'; the oldest means coming before all others in time and refers to MIN(groupYear);\nWhat is the release title of the single under the \"funk\" tag that was released the oldest?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.groupName FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T2.tag LIKE 'funk' AND T1.releaseType = 'single' ORDER BY T1.groupYear LIMIT 1",
"style": "rule"
} | {
"db_id": "music_tracker.sqlite",
"gt_sql": "SELECT T1.groupName FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T2.tag LIKE 'funk' AND T1.releaseType = 'single' ORDER BY T1.groupYear LIMIT 1",
"index": 1022,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['single', 'other', 'funk', '1970s']\n PRIMARY KEY (`index`)\n);\n\nCREATE TABLE torrents (\n groupName text, -- example: ['the release', 'the single', 'released', 'in time', 'release', 'funk']\n totalSnatched integer, -- example: [239, 156]\n groupYear integer, -- example: [1979, 1980]\n releaseType text, -- example: ['single', 'album']\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrelease title of single refers to groupName where releaseType = 'single'; the oldest means coming before all others in time and refers to MIN(groupYear);\nWhat is the release title of the single under the \"funk\" tag that was released the oldest?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['alternative', 'alternate', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\n\nCREATE TABLE torrents (\n groupName text, -- example: ['the release', 'release', 'titles', 'ep', 'released', 'superappin'']\n totalSnatched integer, -- example: [239, 156]\n releaseType text, -- example: ['single', 'album']\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrelease titles of the \"ep's\" refer to groupName where releaseType = 'ep';\nName all the release titles of the \"ep's\" under the alternative tag.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.groupName FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T2.tag LIKE 'alternative' AND T1.releaseType = 'ep'",
"style": "rule"
} | {
"db_id": "music_tracker.sqlite",
"gt_sql": "SELECT T1.groupName FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T2.tag LIKE 'alternative' AND T1.releaseType = 'ep'",
"index": 1023,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['alternative', 'alternate', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\n\nCREATE TABLE torrents (\n groupName text, -- example: ['the release', 'release', 'titles', 'ep', 'released', 'superappin'']\n totalSnatched integer, -- example: [239, 156]\n releaseType text, -- example: ['single', 'album']\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrelease titles of the \"ep's\" refer to groupName where releaseType = 'ep';\nName all the release titles of the \"ep's\" under the alternative tag.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['download', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\n\nCREATE TABLE torrents (\n groupName text, -- example: ['the release', 'release', 'more', 'downloads', 'released', 'superappin'']\n totalSnatched integer, -- example: [239, 156]\n artist text, -- example: ['time', 'grandmaster flash & the furious five', 'ron hunt & ronnie g & the sm crew']\n groupYear integer, -- example: [1979, 1980]\n groupId integer, -- example: [720949, 728752]\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreleases refer to groupName; downloaded for more than 20000 times refers to totalSnatched > 20000;\nPlease list the releases that have been downloaded for more than 20000 times.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT groupName FROM torrents WHERE totalSnatched > 20000",
"style": "rule"
} | {
"db_id": "music_tracker.sqlite",
"gt_sql": "SELECT groupName FROM torrents WHERE totalSnatched > 20000",
"index": 1024,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['download', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\n\nCREATE TABLE torrents (\n groupName text, -- example: ['the release', 'release', 'more', 'downloads', 'released', 'superappin'']\n totalSnatched integer, -- example: [239, 156]\n artist text, -- example: ['time', 'grandmaster flash & the furious five', 'ron hunt & ronnie g & the sm crew']\n groupYear integer, -- example: [1979, 1980]\n groupId integer, -- example: [720949, 728752]\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreleases refer to groupName; downloaded for more than 20000 times refers to totalSnatched > 20000;\nPlease list the releases that have been downloaded for more than 20000 times.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['1970s', 'funk']\n PRIMARY KEY (`index`)\n);\n\nCREATE TABLE torrents (\n groupName text, -- example: ['sugarhill gang', 'the release', 'sugarhill', 'release', 'what', 'gang']\n totalSnatched integer, -- example: [239, 156]\n artist text, -- example: ['sugarhill gang', 'grandmaster flash & the furious five', 'ron hunt & ronnie g & the sm crew']\n groupYear integer, -- example: [1979, 1980]\n releaseType text, -- example: ['single', 'album']\n groupId integer, -- example: [720949, 728752]\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrelease \"sugarhill gang\" refers to groupName = 'sugarhill gang';\nWhat are the tags of the release \"sugarhill gang\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.tag FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T1.groupName = 'sugarhill gang'",
"style": "rule"
} | {
"db_id": "music_tracker.sqlite",
"gt_sql": "SELECT T2.tag FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T1.groupName = 'sugarhill gang'",
"index": 1025,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['1970s', 'funk']\n PRIMARY KEY (`index`)\n);\n\nCREATE TABLE torrents (\n groupName text, -- example: ['sugarhill gang', 'the release', 'sugarhill', 'release', 'what', 'gang']\n totalSnatched integer, -- example: [239, 156]\n artist text, -- example: ['sugarhill gang', 'grandmaster flash & the furious five', 'ron hunt & ronnie g & the sm crew']\n groupYear integer, -- example: [1979, 1980]\n releaseType text, -- example: ['single', 'album']\n groupId integer, -- example: [720949, 728752]\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrelease \"sugarhill gang\" refers to groupName = 'sugarhill gang';\nWhat are the tags of the release \"sugarhill gang\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE torrents (\n groupName text, -- example: ['the release', 'release', 'titles', 'released', 'superappin'', 'spiderap / a corona jam']\n totalSnatched integer, -- example: [239, 156]\n groupId integer, -- example: [720949, 728752]\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['1980s', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntitles refer to groupName;\nPlease list the titles of all the releases with the tag \"1980s\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.groupName FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T2.tag = '1980s'",
"style": "rule"
} | {
"db_id": "music_tracker.sqlite",
"gt_sql": "SELECT T1.groupName FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T2.tag = '1980s'",
"index": 1026,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE torrents (\n groupName text, -- example: ['the release', 'release', 'titles', 'released', 'superappin'', 'spiderap / a corona jam']\n totalSnatched integer, -- example: [239, 156]\n groupId integer, -- example: [720949, 728752]\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['1980s', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntitles refer to groupName;\nPlease list the titles of all the releases with the tag \"1980s\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['download', 'album', 'live', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\n\nCREATE TABLE torrents (\n groupName text, -- example: ['downloads', 'release', 'album', 'live', 'ha', 'released']\n totalSnatched integer, -- example: [239, 156]\n groupYear integer, -- example: [1979, 1980]\n releaseType text, -- example: ['live album', 'album', 'single']\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrelease year refers to groupYear; title of live album refers to groupName where releaseType = 'live album'; the highest number of downloads refers to MAX(totalSnatched);\nProvide the title, release year and the tag associated with the live album that has the highest number of downloads?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.groupName, T1.groupYear, T2.tag FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T1.releaseType = 'live album' ORDER BY T1.totalSnatched DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "music_tracker.sqlite",
"gt_sql": "SELECT T1.groupName, T1.groupYear, T2.tag FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T1.releaseType = 'live album' ORDER BY T1.totalSnatched DESC LIMIT 1",
"index": 1027,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['download', 'album', 'live', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\n\nCREATE TABLE torrents (\n groupName text, -- example: ['downloads', 'release', 'album', 'live', 'ha', 'released']\n totalSnatched integer, -- example: [239, 156]\n groupYear integer, -- example: [1979, 1980]\n releaseType text, -- example: ['live album', 'album', 'single']\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrelease year refers to groupYear; title of live album refers to groupName where releaseType = 'live album'; the highest number of downloads refers to MAX(totalSnatched);\nProvide the title, release year and the tag associated with the live album that has the highest number of downloads?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['download', 'single', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\n\nCREATE TABLE torrents (\n groupName text, -- example: ['at least', 'singles', 'id', 'downloads', 'superappin'', 'spiderap / a corona jam']\n totalSnatched integer, -- example: [239, 156]\n artist text, -- example: ['grandmaster flash & the furious five', 'ron hunt & ronnie g & the sm crew']\n releaseType text, -- example: ['single', 'album']\n groupId integer, -- example: [720949, 728752]\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreleaseType = 'single'; downloaded at least 20 refers to totalSnatched ≥ 20; id from 10 to 20 refer to id between 10 and 20; groups refer to groupName;\nIndicates groups with id from 10 to 20 with singles downloaded at least 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 groupName FROM torrents WHERE totalSnatched >= 20 AND releaseType LIKE 'single' AND id BETWEEN 10 AND 20",
"style": "rule"
} | {
"db_id": "music_tracker.sqlite",
"gt_sql": "SELECT groupName FROM torrents WHERE totalSnatched >= 20 AND releaseType LIKE 'single' AND id BETWEEN 10 AND 20",
"index": 1028,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['download', 'single', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\n\nCREATE TABLE torrents (\n groupName text, -- example: ['at least', 'singles', 'id', 'downloads', 'superappin'', 'spiderap / a corona jam']\n totalSnatched integer, -- example: [239, 156]\n artist text, -- example: ['grandmaster flash & the furious five', 'ron hunt & ronnie g & the sm crew']\n releaseType text, -- example: ['single', 'album']\n groupId integer, -- example: [720949, 728752]\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreleaseType = 'single'; downloaded at least 20 refers to totalSnatched ≥ 20; id from 10 to 20 refer to id between 10 and 20; groups refer to groupName;\nIndicates groups with id from 10 to 20 with singles downloaded at least 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 torrents (\n groupName text, -- example: ['released', 'the most', 'release', 'later', 'most', 'ha']\n totalSnatched integer, -- example: [239, 156]\n groupYear integer, -- example: [1979, 1980]\n groupId integer, -- example: [720949, 728752]\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['download', 'jazz', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most downloaded refers to MAX(totalSnatched); tag = 'jazz'; from 1982 or later refers to groupYear ≥ 1982;\nList the group name has the most downloaded that have released jazz genres from 1982 or later.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.groupName FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T2.tag = 'jazz' AND T1.groupYear >= 1982 ORDER BY T1.totalSnatched DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "music_tracker.sqlite",
"gt_sql": "SELECT T1.groupName FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T2.tag = 'jazz' AND T1.groupYear >= 1982 ORDER BY T1.totalSnatched DESC LIMIT 1",
"index": 1029,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE torrents (\n groupName text, -- example: ['released', 'the most', 'release', 'later', 'most', 'ha']\n totalSnatched integer, -- example: [239, 156]\n groupYear integer, -- example: [1979, 1980]\n groupId integer, -- example: [720949, 728752]\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['download', 'jazz', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most downloaded refers to MAX(totalSnatched); tag = 'jazz'; from 1982 or later refers to groupYear ≥ 1982;\nList the group name has the most downloaded that have released jazz genres from 1982 or later.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE torrents (\n groupName text, -- example: ['released', 'the name', 'release', 'mixtape', 'artist', 'dance']\n artist text, -- example: ['grandmaster flash & the furious five', 'ron hunt & ronnie g & the sm crew']\n groupYear integer, -- example: [1979, 1980]\n releaseType text, -- example: ['mixtape', 'album', 'single']\n groupId integer, -- example: [720949, 728752]\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['mixtape', 'dance', 'album', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nalbums and mixtape refer to releaseType; from 1980 to 1985 refers to groupYear between 1980 and 1985; tag = 'dance';\nList the name of artists who have released albums and mixtape from 1980 to 1985 in \"dance\" genre.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.artist) FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T2.tag = 'dance' AND T1.groupYear BETWEEN 1980 AND 1985 AND T1.releaseType LIKE 'album' OR T1.releaseType LIKE 'mixtape'",
"style": "rule"
} | {
"db_id": "music_tracker.sqlite",
"gt_sql": "SELECT COUNT(T1.artist) FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T2.tag = 'dance' AND T1.groupYear BETWEEN 1980 AND 1985 AND T1.releaseType LIKE 'album' OR T1.releaseType LIKE 'mixtape'",
"index": 1030,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE torrents (\n groupName text, -- example: ['released', 'the name', 'release', 'mixtape', 'artist', 'dance']\n artist text, -- example: ['grandmaster flash & the furious five', 'ron hunt & ronnie g & the sm crew']\n groupYear integer, -- example: [1979, 1980]\n releaseType text, -- example: ['mixtape', 'album', 'single']\n groupId integer, -- example: [720949, 728752]\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['mixtape', 'dance', 'album', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nalbums and mixtape refer to releaseType; from 1980 to 1985 refers to groupYear between 1980 and 1985; tag = 'dance';\nList the name of artists who have released albums and mixtape from 1980 to 1985 in \"dance\" genre.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['single', 'soul', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\n\nCREATE TABLE torrents (\n groupName text, -- example: ['released', 'release', 'singles', 'soul', 'superappin'', 'spiderap / a corona jam']\n totalSnatched integer, -- example: [239, 156]\n groupYear integer, -- example: [1979, 1980]\n releaseType text, -- example: ['single', 'album']\n groupId integer, -- example: [720949, 728752]\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreleaseType = 'single'; between 1979 and 1981 refers to groupYear between 1979 and 1981; tag = 'soul';\nHow many singles were released between 1979 and 1981 labeled as \"soul\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.tag) FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T2.tag = 'soul' AND T1.groupYear BETWEEN 1979 AND 1981 AND T1.releaseType LIKE 'single'",
"style": "rule"
} | {
"db_id": "music_tracker.sqlite",
"gt_sql": "SELECT COUNT(T2.tag) FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T2.tag = 'soul' AND T1.groupYear BETWEEN 1979 AND 1981 AND T1.releaseType LIKE 'single'",
"index": 1031,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['single', 'soul', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\n\nCREATE TABLE torrents (\n groupName text, -- example: ['released', 'release', 'singles', 'soul', 'superappin'', 'spiderap / a corona jam']\n totalSnatched integer, -- example: [239, 156]\n groupYear integer, -- example: [1979, 1980]\n releaseType text, -- example: ['single', 'album']\n groupId integer, -- example: [720949, 728752]\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreleaseType = 'single'; between 1979 and 1981 refers to groupYear between 1979 and 1981; tag = 'soul';\nHow many singles were released between 1979 and 1981 labeled as \"soul\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE torrents (\n groupName text, -- example: ['released', 'release', 'singles', 'superappin'', 'spiderap / a corona jam']\n artist text, -- example: ['grandmaster flash & the furious five', 'ron hunt & ronnie g & the sm crew']\n groupYear integer, -- example: [1979, 1980]\n releaseType text, -- example: ['single', 'album']\n groupId integer, -- example: [720949, 728752]\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['single', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreleaseType = 'single'; groupYear = 1979;\nHow many singles were released in 1979?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(releaseType) FROM torrents WHERE releaseType LIKE 'single' AND groupYear = 1979",
"style": "rule"
} | {
"db_id": "music_tracker.sqlite",
"gt_sql": "SELECT COUNT(releaseType) FROM torrents WHERE releaseType LIKE 'single' AND groupYear = 1979",
"index": 1032,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE torrents (\n groupName text, -- example: ['released', 'release', 'singles', 'superappin'', 'spiderap / a corona jam']\n artist text, -- example: ['grandmaster flash & the furious five', 'ron hunt & ronnie g & the sm crew']\n groupYear integer, -- example: [1979, 1980]\n releaseType text, -- example: ['single', 'album']\n groupId integer, -- example: [720949, 728752]\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['single', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreleaseType = 'single'; groupYear = 1979;\nHow many singles were released in 1979?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE torrents (\n groupName text, -- example: ['released', 'release', 'singles', 'artist', 'sugar', 'superappin'']\n totalSnatched integer, -- example: [239, 156]\n artist text, -- example: ['sugar daddy', 'sugar', 'daddy k', 'sugar c', 'grandmaster flash & the furious five', 'ron hunt & ronnie g & the sm crew']\n groupYear integer, -- example: [1979, 1980]\n releaseType text, -- example: ['single', 'album']\n groupId integer, -- example: [720949, 728752]\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n PRIMARY KEY (`index`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsugar daddy is an artist; releaseType = 'single'; groupYear = 1980;\nIn 1980, how many singles were released by sugar daddy?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(releaseType) FROM torrents WHERE artist LIKE 'sugar daddy' AND releaseType LIKE 'Single' AND groupYear = 1980",
"style": "rule"
} | {
"db_id": "music_tracker.sqlite",
"gt_sql": "SELECT COUNT(releaseType) FROM torrents WHERE artist LIKE 'sugar daddy' AND releaseType LIKE 'Single' AND groupYear = 1980",
"index": 1033,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE torrents (\n groupName text, -- example: ['released', 'release', 'singles', 'artist', 'sugar', 'superappin'']\n totalSnatched integer, -- example: [239, 156]\n artist text, -- example: ['sugar daddy', 'sugar', 'daddy k', 'sugar c', 'grandmaster flash & the furious five', 'ron hunt & ronnie g & the sm crew']\n groupYear integer, -- example: [1979, 1980]\n releaseType text, -- example: ['single', 'album']\n groupId integer, -- example: [720949, 728752]\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n PRIMARY KEY (`index`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsugar daddy is an artist; releaseType = 'single'; groupYear = 1980;\nIn 1980, how many singles were released by sugar daddy?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['christmas', 'album', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\n\nCREATE TABLE torrents (\n groupName text, -- example: ['christmas', 'released', 'release', 'album', 'superappin'', 'spiderap / a corona jam']\n artist text, -- example: ['grandmaster flash & the furious five', 'ron hunt & ronnie g & the sm crew']\n groupYear integer, -- example: [1979, 1980]\n releaseType text, -- example: ['album', 'single']\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nalbum refers to releaseType; groupYear = 2004; tag = 'christmas';\nHow many christmas albums were released in 2004?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T1.id) FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T2.tag = 'christmas' AND T1.groupYear = 2004 AND T1.releaseType LIKE 'album'",
"style": "rule"
} | {
"db_id": "music_tracker.sqlite",
"gt_sql": "SELECT COUNT(T1.id) FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T2.tag = 'christmas' AND T1.groupYear = 2004 AND T1.releaseType LIKE 'album'",
"index": 1034,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['christmas', 'album', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\n\nCREATE TABLE torrents (\n groupName text, -- example: ['christmas', 'released', 'release', 'album', 'superappin'', 'spiderap / a corona jam']\n artist text, -- example: ['grandmaster flash & the furious five', 'ron hunt & ronnie g & the sm crew']\n groupYear integer, -- example: [1979, 1980]\n releaseType text, -- example: ['album', 'single']\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nalbum refers to releaseType; groupYear = 2004; tag = 'christmas';\nHow many christmas albums were released in 2004?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['jackson', 'album', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\n\nCREATE TABLE torrents (\n groupName text, -- example: ['released', 'release', 'artist', 'album', 'superappin'', 'spiderap / a corona jam']\n totalSnatched integer, -- example: [239, 156]\n artist text, -- example: ['millie jackson', 'c milli', 'grandmaster flash & the furious five', 'ron hunt & ronnie g & the sm crew']\n groupYear integer, -- example: [1979, 1980]\n releaseType text, -- example: ['album', 'single']\n groupId integer, -- example: [720949, 728752]\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmillie jackson is an artist; album title refers to groupName where releaseType = 'album'; groupYear = 1980;\nWhich album title and tag that millie jackson released in 1980?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.groupName, T2.tag FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T1.groupYear = 1980 AND T1.artist LIKE 'millie jackson' AND T1.releaseType LIKE 'album'",
"style": "rule"
} | {
"db_id": "music_tracker.sqlite",
"gt_sql": "SELECT T1.groupName, T2.tag FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T1.groupYear = 1980 AND T1.artist LIKE 'millie jackson' AND T1.releaseType LIKE 'album'",
"index": 1035,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['jackson', 'album', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\n\nCREATE TABLE torrents (\n groupName text, -- example: ['released', 'release', 'artist', 'album', 'superappin'', 'spiderap / a corona jam']\n totalSnatched integer, -- example: [239, 156]\n artist text, -- example: ['millie jackson', 'c milli', 'grandmaster flash & the furious five', 'ron hunt & ronnie g & the sm crew']\n groupYear integer, -- example: [1979, 1980]\n releaseType text, -- example: ['album', 'single']\n groupId integer, -- example: [720949, 728752]\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmillie jackson is an artist; album title refers to groupName where releaseType = 'album'; groupYear = 1980;\nWhich album title and tag that millie jackson released in 1980?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE torrents (\n artist text, -- example: ['disco d', 'grandmaster flash & the furious five', 'ron hunt & ronnie g & the sm crew']\n groupYear integer, -- example: [1979, 1980]\n releaseType text, -- example: ['single', 'album']\n groupId integer, -- example: [720949, 728752]\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['disco', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrom 1980 to 2000 refers to groupYear between 1980 and 2000; tag = 'disco'; the most releases refer to MAX(COUNT(id));\nFrom 1980 to 2000, which artist had the most disco releases?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.artist FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T1.groupYear BETWEEN 1980 AND 2000 AND T2.tag LIKE 'disco' GROUP BY T1.artist ORDER BY COUNT(T2.tag) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "music_tracker.sqlite",
"gt_sql": "SELECT T1.artist FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T1.groupYear BETWEEN 1980 AND 2000 AND T2.tag LIKE 'disco' GROUP BY T1.artist ORDER BY COUNT(T2.tag) DESC LIMIT 1",
"index": 1036,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE torrents (\n artist text, -- example: ['disco d', 'grandmaster flash & the furious five', 'ron hunt & ronnie g & the sm crew']\n groupYear integer, -- example: [1979, 1980]\n releaseType text, -- example: ['single', 'album']\n groupId integer, -- example: [720949, 728752]\n id integer, -- example: [0, 1]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE tags (\n `index` integer, -- example: [0, 1]\n id integer, -- example: [0, 2]\n tag text, -- example: ['disco', '1970s', 'funk']\n PRIMARY KEY (`index`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrom 1980 to 2000 refers to groupYear between 1980 and 2000; tag = 'disco'; the most releases refer to MAX(COUNT(id));\nFrom 1980 to 2000, which artist had the most disco releases?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngroup of Heavily Indebted Poor Countries is OtherGroups = 'HIPC'; International Development Associations refers to lendingcategory = 'IDA'\nAmong the countries in the group of Heavily Indebted Poor Countries, how many of them are under the lending category of the International Development Associations?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(CountryCode) FROM Country WHERE LendingCategory = 'IDA' AND OtherGroups = 'HIPC'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT COUNT(CountryCode) FROM Country WHERE LendingCategory = 'IDA' AND OtherGroups = 'HIPC'",
"index": 1037,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngroup of Heavily Indebted Poor Countries is OtherGroups = 'HIPC'; International Development Associations refers to lendingcategory = 'IDA'\nAmong the countries in the group of Heavily Indebted Poor Countries, how many of them are under the lending category of the International Development Associations?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Series (\n SeriesCode text, -- example: ['SM.POP.TOTL', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n Periodicity text, -- example: ['Annual']\n OtherNotes integer,\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Aruba', 'Afghanistan', 'Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SM.POP.TOTL', 'EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['SM.POP.TOTL', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SM.POP.TOTL', 'AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAruba is the name of the country where ShortName = 'Aruba'\nWhat's the description of the series code SM.POP.TOTL for Aruba?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.Description FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T1.ShortName = 'Aruba' AND T2.Seriescode = 'SM.POP.TOTL'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT T2.Description FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T1.ShortName = 'Aruba' AND T2.Seriescode = 'SM.POP.TOTL'",
"index": 1038,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Series (\n SeriesCode text, -- example: ['SM.POP.TOTL', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n Periodicity text, -- example: ['Annual']\n OtherNotes integer,\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Aruba', 'Afghanistan', 'Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SM.POP.TOTL', 'EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['SM.POP.TOTL', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SM.POP.TOTL', 'AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAruba is the name of the country where ShortName = 'Aruba'\nWhat's the description of the series code SM.POP.TOTL for Aruba?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['SM.POP.TOTL', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SM.POP.TOTL', 'AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['SM.POP.TOTL', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n Region text, -- example: ['Latin America & Caribbean', 'South Asia', 'Europe & Central Asia']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SM.POP.TOTL', 'EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCountries refer to the ShortName; Latin America & Caribbean is the name of the region\nPlease list the countries in Latin America & Caribbean with a note on the series code SM.POP.TOTL.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.SHORTNAME, T2.Description FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T1.Region = 'Latin America & Caribbean' AND T2.Seriescode = 'SM.POP.TOTL'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT T1.SHORTNAME, T2.Description FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T1.Region = 'Latin America & Caribbean' AND T2.Seriescode = 'SM.POP.TOTL'",
"index": 1039,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['SM.POP.TOTL', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SM.POP.TOTL', 'AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['SM.POP.TOTL', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n Region text, -- example: ['Latin America & Caribbean', 'South Asia', 'Europe & Central Asia']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SM.POP.TOTL', 'EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCountries refer to the ShortName; Latin America & Caribbean is the name of the region\nPlease list the countries in Latin America & Caribbean with a note on the series code SM.POP.TOTL.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Low income', 'Afghanistan', 'Albania']\n LongName text, -- example: ['Low income', 'Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['SM.POP.TOTL', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SM.POP.TOTL', 'AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Low income', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['SM.POP.TOTL', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SM.POP.TOTL', 'EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlow-income countries are where the incomegroup = Low income\nHow many low-income countries under the lending category of the International Development Associations have a note on the series code SM.POP.TOTL?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Countrycode) FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T1.LendingCategory = 'IDA' AND T2.Seriescode = 'SM.POP.TOTL' AND IncomeGroup = 'Low income'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT COUNT(T1.Countrycode) FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T1.LendingCategory = 'IDA' AND T2.Seriescode = 'SM.POP.TOTL' AND IncomeGroup = 'Low income'",
"index": 1040,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Low income', 'Afghanistan', 'Albania']\n LongName text, -- example: ['Low income', 'Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['SM.POP.TOTL', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SM.POP.TOTL', 'AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Low income', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['SM.POP.TOTL', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SM.POP.TOTL', 'EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlow-income countries are where the incomegroup = Low income\nHow many low-income countries under the lending category of the International Development Associations have a note on the series code SM.POP.TOTL?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SM.POP.TOTL', 'AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Estimates', 'Estimate', 'Estimates.', 'Estimate.', 'Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['SM.POP.TOTL', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n Periodicity text, -- example: ['Annual']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['SM.POP.TOTL', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SM.POP.TOTL', 'EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the long name of the country with the description \"Estimates are derived from data on foreign-born population.\" on the series code SM.POP.TOTL?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.LongName FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T2.Description = 'Estimates are derived FROM data on foreign-born population.' AND T2.Seriescode = 'SM.POP.TOTL'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT T1.LongName FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T2.Description = 'Estimates are derived FROM data on foreign-born population.' AND T2.Seriescode = 'SM.POP.TOTL'",
"index": 1041,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SM.POP.TOTL', 'AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Estimates', 'Estimate', 'Estimates.', 'Estimate.', 'Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['SM.POP.TOTL', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n Periodicity text, -- example: ['Annual']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['SM.POP.TOTL', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SM.POP.TOTL', 'EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the long name of the country with the description \"Estimates are derived from data on foreign-born population.\" on the series code SM.POP.TOTL?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Aruba', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.FRST.K2', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.LND.FRST.K2', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Aruba', 'Afghanistan', 'Albania']\n TableName text, -- example: ['Aruba', 'Afghanistan', 'Albania']\n LongName text, -- example: ['Aruba', 'Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAruba is the name of country where ShortName = 'Aruba'\nOn which years did Aruba got a footnote on the series code AG.LND.FRST.K2?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.Year FROM Country AS T1 INNER JOIN FootNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T1.ShortName = 'Aruba' AND T2.Seriescode = 'AG.LND.FRST.K2'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT T2.Year FROM Country AS T1 INNER JOIN FootNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T1.ShortName = 'Aruba' AND T2.Seriescode = 'AG.LND.FRST.K2'",
"index": 1042,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Aruba', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.FRST.K2', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.LND.FRST.K2', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Aruba', 'Afghanistan', 'Albania']\n TableName text, -- example: ['Aruba', 'Afghanistan', 'Albania']\n LongName text, -- example: ['Aruba', 'Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAruba is the name of country where ShortName = 'Aruba'\nOn which years did Aruba got a footnote on the series code AG.LND.FRST.K2?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Aruba', 'Afghanistan', 'Albania']\n TableName text, -- example: ['Aruba', 'Afghanistan', 'Albania']\n LongName text, -- example: ['Aruba', 'Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['BX.KLT.DINV.CD.WD', 'EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['BX.KLT.DINV.CD.WD', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['BX.KLT.DINV.CD.WD', 'AG.LND.FRST.K2']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['BX.KLT.DINV.CD.WD', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAruba is the name of country where ShortName = 'Aruba'\nFor how many consecutive years did Aruba get a footnote on the series code BX.KLT.DINV.CD.WD?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Year) FROM Country AS T1 INNER JOIN FootNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T1.ShortName = 'Aruba' AND T2.Seriescode = 'BX.KLT.DINV.CD.WD'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT COUNT(T2.Year) FROM Country AS T1 INNER JOIN FootNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T1.ShortName = 'Aruba' AND T2.Seriescode = 'BX.KLT.DINV.CD.WD'",
"index": 1043,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Aruba', 'Afghanistan', 'Albania']\n TableName text, -- example: ['Aruba', 'Afghanistan', 'Albania']\n LongName text, -- example: ['Aruba', 'Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['BX.KLT.DINV.CD.WD', 'EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['BX.KLT.DINV.CD.WD', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['BX.KLT.DINV.CD.WD', 'AG.LND.FRST.K2']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['BX.KLT.DINV.CD.WD', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAruba is the name of country where ShortName = 'Aruba'\nFor how many consecutive years did Aruba get a footnote on the series code BX.KLT.DINV.CD.WD?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Periodicity text, -- example: ['Annual']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n OtherWebLinks integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIn which country's latest trade data and latest water withdrawal data were both updated in the year 2013? Give its long name and Alpha 2 code.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT LongName, Alpha2Code FROM Country WHERE LatestTradeData = 2013 AND LatestWaterWithdrawalData = 2013",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT LongName, Alpha2Code FROM Country WHERE LatestTradeData = 2013 AND LatestWaterWithdrawalData = 2013",
"index": 1044,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Periodicity text, -- example: ['Annual']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n OtherWebLinks integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIn which country's latest trade data and latest water withdrawal data were both updated in the year 2013? Give its long name and Alpha 2 code.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Environment: Emissions', 'Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n LicenseType text, -- example: ['Restricted', 'Open']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n TableName text, -- example: ['Afghanistan', 'Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\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 series codes in which the topic is about Environment: Emissions and the license type is restricted. Please include their alpha code.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SeriesCode FROM Series WHERE Topic = 'Environment: Emissions' AND LicenseType = 'Restricted'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT SeriesCode FROM Series WHERE Topic = 'Environment: Emissions' AND LicenseType = 'Restricted'",
"index": 1045,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Environment: Emissions', 'Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n LicenseType text, -- example: ['Restricted', 'Open']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n TableName text, -- example: ['Afghanistan', 'Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\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 series codes in which the topic is about Environment: Emissions and the license type is restricted. Please include their alpha code.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Albania', 'Afghanistan']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAlbania is the name of country where Country = 'Albania'\nPlease write down the footnote descriptions of Albania in 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 DISTINCT T1.Description FROM FootNotes AS T1 INNER JOIN Country AS T2 ON T1.Countrycode = T2.CountryCode WHERE T1.Year = 'YR1981' AND T2.ShortName = 'Albania'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT DISTINCT T1.Description FROM FootNotes AS T1 INNER JOIN Country AS T2 ON T1.Countrycode = T2.CountryCode WHERE T1.Year = 'YR1981' AND T2.ShortName = 'Albania'",
"index": 1046,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Albania', 'Afghanistan']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAlbania is the name of country where Country = 'Albania'\nPlease write down the footnote descriptions of Albania in 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 Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['The Bahamas', 'Afghanistan', 'Albania']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SH.DTH.IMRT', 'AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['SH.DTH.IMRT', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['SH.DTH.IMRT', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n UnitOfMeasure text, -- example: ['`', '%']\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n PRIMARY KEY (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnarratives is Description; The Bahamas is the name of the country where Country = 'The Bahamas'\nEnumerate the footnote narratives of The Bahamas under the series code SH.DTH.IMRT in the year 1984.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.Description FROM FootNotes AS T1 INNER JOIN Country AS T2 ON T1.Countrycode = T2.CountryCode WHERE T1.Year = 'YR1984' AND T2.ShortName = 'The Bahamas' AND T1.Seriescode = 'SH.DTH.IMRT'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT DISTINCT T1.Description FROM FootNotes AS T1 INNER JOIN Country AS T2 ON T1.Countrycode = T2.CountryCode WHERE T1.Year = 'YR1984' AND T2.ShortName = 'The Bahamas' AND T1.Seriescode = 'SH.DTH.IMRT'",
"index": 1047,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['The Bahamas', 'Afghanistan', 'Albania']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SH.DTH.IMRT', 'AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['SH.DTH.IMRT', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['SH.DTH.IMRT', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n UnitOfMeasure text, -- example: ['`', '%']\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n PRIMARY KEY (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnarratives is Description; The Bahamas is the name of the country where Country = 'The Bahamas'\nEnumerate the footnote narratives of The Bahamas under the series code SH.DTH.IMRT in the year 1984.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Sweden', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Sweden', 'Afghanistan', 'Albania']\n TableName text, -- example: ['Sweden', 'Afghanistan', 'Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['US', 'AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNet bilateral aid flows from DAC donors, Sweden (current US$) is the name of indicator where IndicatorName = 'Net bilateral aid flows from DAC donors, Sweden (current US$)'; Year = 1970; Value > 570,000\nWhat is the short name of the country in which the \"Net bilateral aid flows from DAC donors, Sweden (current US$)\" indicator hit the 570,000 value in 1970?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.ShortName FROM Indicators AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IndicatorName = 'Net bilateral aid flows FROM DAC donors, Sweden (current US$)' AND T1.Year = 1970 AND T1.Value = 570000",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT T2.ShortName FROM Indicators AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IndicatorName = 'Net bilateral aid flows FROM DAC donors, Sweden (current US$)' AND T1.Year = 1970 AND T1.Value = 570000",
"index": 1048,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Sweden', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Sweden', 'Afghanistan', 'Albania']\n TableName text, -- example: ['Sweden', 'Afghanistan', 'Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['US', 'AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNet bilateral aid flows from DAC donors, Sweden (current US$) is the name of indicator where IndicatorName = 'Net bilateral aid flows from DAC donors, Sweden (current US$)'; Year = 1970; Value > 570,000\nWhat is the short name of the country in which the \"Net bilateral aid flows from DAC donors, Sweden (current US$)\" indicator hit the 570,000 value in 1970?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Fertility rate, total (births per woman)', 'Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['PER', 'ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['PER', 'ABW', 'ADO']\n IndicatorName text, -- example: ['Fertility rate, total (births per woman)', 'Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nYear = 1979; fertility rate refers to IndicatorName = 'Fertility rate, total (births per woman)'; Value is between 4 and 5;\nWhich countries have a fertility rate between 4 and 5 in 1979? List their names.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CountryName FROM Indicators WHERE Year = 1979 AND IndicatorName = 'Fertility rate, total (births per woman)' AND value >= 4 AND Value <= 5",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT CountryName FROM Indicators WHERE Year = 1979 AND IndicatorName = 'Fertility rate, total (births per woman)' AND value >= 4 AND Value <= 5",
"index": 1049,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Fertility rate, total (births per woman)', 'Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['PER', 'ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['PER', 'ABW', 'ADO']\n IndicatorName text, -- example: ['Fertility rate, total (births per woman)', 'Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nYear = 1979; fertility rate refers to IndicatorName = 'Fertility rate, total (births per woman)'; Value is between 4 and 5;\nWhich countries have a fertility rate between 4 and 5 in 1979? List their names.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Latin America & Caribbean', 'Afghanistan', 'Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AG', 'AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['Latin America & Caribbean', 'South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n Periodicity text, -- example: ['Annual']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n PRIMARY KEY (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLatin America & Caribbean is the name of the region; children who finished primary school education refer to IndicatorName = 'Out-of-school children of primary school age, both sexes (number)'; sources refer to Description;\nWhat are the sources for the data of children who finished primary school education in Latin America & Caribbean countries?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.Source FROM Footnotes AS T1 INNER JOIN Series AS T2 ON T1.Seriescode = T2.SeriesCode INNER JOIN Country AS T3 ON T1.Countrycode = T3.CountryCode WHERE T3.Region = 'Latin America & Caribbean' AND T2.IndicatorName = 'Children out of school, primary'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT DISTINCT T2.Source FROM Footnotes AS T1 INNER JOIN Series AS T2 ON T1.Seriescode = T2.SeriesCode INNER JOIN Country AS T3 ON T1.Countrycode = T3.CountryCode WHERE T3.Region = 'Latin America & Caribbean' AND T2.IndicatorName = 'Children out of school, primary'",
"index": 1050,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Latin America & Caribbean', 'Afghanistan', 'Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AG', 'AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['Latin America & Caribbean', 'South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n Periodicity text, -- example: ['Annual']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n PRIMARY KEY (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLatin America & Caribbean is the name of the region; children who finished primary school education refer to IndicatorName = 'Out-of-school children of primary school age, both sexes (number)'; sources refer to Description;\nWhat are the sources for the data of children who finished primary school education in Latin America & Caribbean countries?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['North America', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['North America', 'Afghanistan', 'Albania']\n TableName text, -- example: ['North America', 'Afghanistan', 'Albania']\n LongName text, -- example: ['North America', 'Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AG', 'AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['North America', 'South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AG', 'AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNorth American is the name of the region; sources refer to Description; children who finished primary school education refer to IndicatorName = 'Out-of-school children of primary school age, both sexes (number)';\nWhat are the sources for the data of children who finished primary school education in North American countries?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T3.Description FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode INNER JOIN CountryNotes AS T3 ON T2.CountryCode = T3.Countrycode WHERE T1.Region = 'North America' AND T2.IndicatorName = 'Out-of-school children of primary school age, both sexes (number)'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT DISTINCT T3.Description FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode INNER JOIN CountryNotes AS T3 ON T2.CountryCode = T3.Countrycode WHERE T1.Region = 'North America' AND T2.IndicatorName = 'Out-of-school children of primary school age, both sexes (number)'",
"index": 1051,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['North America', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['North America', 'Afghanistan', 'Albania']\n TableName text, -- example: ['North America', 'Afghanistan', 'Albania']\n LongName text, -- example: ['North America', 'Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AG', 'AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['North America', 'South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AG', 'AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNorth American is the name of the region; sources refer to Description; children who finished primary school education refer to IndicatorName = 'Out-of-school children of primary school age, both sexes (number)';\nWhat are the sources for the data of children who finished primary school education in North American countries?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 CountryCode text, -- example: ['ABW', 'ADO']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Region text, -- example: ['Sub-Saharan Africa', 'South Asia', 'Europe & Central Asia']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n SystemOfTrade text, -- example: ['Special trade system', 'General trade system']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n UnitOfMeasure text, -- example: ['`', '%']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSub-Saharan African is the name of the region; SystemOfTrade = 'Special trade system'; countries refer to CountryCode; DIVIDE(COUNT (CountryCode where SystemOfTrade = 'Special trade system' and Region = 'Sub-Saharan Africa'), COUNT(CountryCode where Region = 'Sub-Saharan Africa')) as percentage;\nPlease calculate the percentage of Sub-Saharan African countries which are in the Special trade system.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Region = 'Sub-Saharan Africa' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(CountryCode) FROM Country WHERE SystemOfTrade = 'Special trade system'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN Region = 'Sub-Saharan Africa' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(CountryCode) FROM Country WHERE SystemOfTrade = 'Special trade system'",
"index": 1052,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 CountryCode text, -- example: ['ABW', 'ADO']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Region text, -- example: ['Sub-Saharan Africa', 'South Asia', 'Europe & Central Asia']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n SystemOfTrade text, -- example: ['Special trade system', 'General trade system']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n UnitOfMeasure text, -- example: ['`', '%']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSub-Saharan African is the name of the region; SystemOfTrade = 'Special trade system'; countries refer to CountryCode; DIVIDE(COUNT (CountryCode where SystemOfTrade = 'Special trade system' and Region = 'Sub-Saharan Africa'), COUNT(CountryCode where Region = 'Sub-Saharan Africa')) as percentage;\nPlease calculate the percentage of Sub-Saharan African countries which are in the Special trade system.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['International migrant stock, total', 'Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['International migrant stock, total', 'Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIndicatorName = 'International migrant stock, total'; heavily indebted poor countries referred to by its abbreviated 'HIPC' = OtherGroups; MIN(Value);\nWhat is the minimum of International migrant stock, total of heavily indebted poor countries?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT MIN(T2.Value) FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.OtherGroups = 'HIPC' AND T2.IndicatorName = 'International migrant stock, total'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT MIN(T2.Value) FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.OtherGroups = 'HIPC' AND T2.IndicatorName = 'International migrant stock, total'",
"index": 1053,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['International migrant stock, total', 'Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['International migrant stock, total', 'Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIndicatorName = 'International migrant stock, total'; heavily indebted poor countries referred to by its abbreviated 'HIPC' = OtherGroups; MIN(Value);\nWhat is the minimum of International migrant stock, total of heavily indebted poor countries?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Life expectancy at birth, female (years)', 'Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n LongName text, -- example: ['South Asia', 'Islamic State of Afghanistan', 'Republic of Albania']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Life expectancy at birth, female (years)', 'Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSouth Asia is the name of the region; IndicatorName = 'Life expectancy at birth, female (years)'; greater than 50 refers to Value>50; DIVIDE(COUNT(CountryCode where IndicatorName = 'Life expectancy at birth, female (years)'; Value>50; Region = 'South Asia'), COUNT(CountryCode where Region = 'South Asia')) as percentage;\nWhat percentage of countries in South Asia have the Life expectancy at birth, female (years) greater than 50?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T2.value > 50 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.CountryCode) FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Region = 'South Asia' AND T2.IndicatorName = 'Life expectancy at birth, female (years)'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T2.value > 50 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.CountryCode) FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Region = 'South Asia' AND T2.IndicatorName = 'Life expectancy at birth, female (years)'",
"index": 1054,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Life expectancy at birth, female (years)', 'Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n LongName text, -- example: ['South Asia', 'Islamic State of Afghanistan', 'Republic of Albania']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Life expectancy at birth, female (years)', 'Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSouth Asia is the name of the region; IndicatorName = 'Life expectancy at birth, female (years)'; greater than 50 refers to Value>50; DIVIDE(COUNT(CountryCode where IndicatorName = 'Life expectancy at birth, female (years)'; Value>50; Region = 'South Asia'), COUNT(CountryCode where Region = 'South Asia')) as percentage;\nWhat percentage of countries in South Asia have the Life expectancy at birth, female (years) greater than 50?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['PER', 'ABW', 'ADO']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['PER', 'ABW', 'ADO']\n IndicatorName text, -- example: ['Death rate, crude (per 1,000 people)', 'Birth rate, crude (per 1,000 people)', 'Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Death rate, crude (per 1,000 people)', 'Birth rate, crude (per 1,000 people)', 'Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIndicatorName = 'Death rate, crude (per 1,000 people)'; the highest refers to MAX(Value); from 1960 to 1965 refers to Year between '1960' and '1965'; country refers to CountryName;\nFrom 1960 to 1965, which country had the highest Death rate, crude (per 1,000 people)?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CountryName FROM Indicators WHERE Year BETWEEN 1960 AND 1965 AND IndicatorName = 'Death rate, crude (per 1,000 people)' ORDER BY Value DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT CountryName FROM Indicators WHERE Year BETWEEN 1960 AND 1965 AND IndicatorName = 'Death rate, crude (per 1,000 people)' ORDER BY Value DESC LIMIT 1",
"index": 1055,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['PER', 'ABW', 'ADO']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['PER', 'ABW', 'ADO']\n IndicatorName text, -- example: ['Death rate, crude (per 1,000 people)', 'Birth rate, crude (per 1,000 people)', 'Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Death rate, crude (per 1,000 people)', 'Birth rate, crude (per 1,000 people)', 'Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIndicatorName = 'Death rate, crude (per 1,000 people)'; the highest refers to MAX(Value); from 1960 to 1965 refers to Year between '1960' and '1965'; country refers to CountryName;\nFrom 1960 to 1965, which country had the highest Death rate, crude (per 1,000 people)?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['US', 'AF', 'AL']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncountry refers to CountryName; the highest value implies MAX(Value); IndicatorName = 'Merchandise imports by the reporting economy (current US$)';\nWhich country has the highest value of Merchandise imports by the reporting economy (current US$)?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CountryName FROM Indicators WHERE IndicatorName = 'Merchandise imports by the reporting economy (current US$)' ORDER BY Value DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT CountryName FROM Indicators WHERE IndicatorName = 'Merchandise imports by the reporting economy (current US$)' ORDER BY Value DESC LIMIT 1",
"index": 1056,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['US', 'AF', 'AL']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncountry refers to CountryName; the highest value implies MAX(Value); IndicatorName = 'Merchandise imports by the reporting economy (current US$)';\nWhich country has the highest value of Merchandise imports by the reporting economy (current US$)?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrom 1968 to 1970 refers to Year between '1968' and '1970'; values are less than 100 imply Value<100;\nFrom 1968 to 1970, what are indicator names whose license type is open and values are less than 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 DISTINCT T1.IndicatorName FROM Indicators AS T1 INNER JOIN Series AS T2 ON T1.IndicatorName = T2.IndicatorName WHERE T1.Year >= 1968 AND T1.Year < 1971 AND T2.LicenseType = 'Open' AND T1.Value < 100",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT DISTINCT T1.IndicatorName FROM Indicators AS T1 INNER JOIN Series AS T2 ON T1.IndicatorName = T2.IndicatorName WHERE T1.Year >= 1968 AND T1.Year < 1971 AND T2.LicenseType = 'Open' AND T1.Value < 100",
"index": 1057,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrom 1968 to 1970 refers to Year between '1968' and '1970'; values are less than 100 imply Value<100;\nFrom 1968 to 1970, what are indicator names whose license type is open and values are less than 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 Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Private Sector & Trade: Exports', 'Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncountry refers to CountryName;\nWhich country had the highest value of indicator belongs to Private Sector & Trade: Exports topic? Please list the country name and indicator name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.CountryName, T1.IndicatorName FROM Indicators AS T1 INNER JOIN Series AS T2 ON T1.IndicatorName = T2.IndicatorName WHERE T2.Topic = 'Private Sector & Trade: Exports' ORDER BY T1.Value DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT T1.CountryName, T1.IndicatorName FROM Indicators AS T1 INNER JOIN Series AS T2 ON T1.IndicatorName = T2.IndicatorName WHERE T2.Topic = 'Private Sector & Trade: Exports' ORDER BY T1.Value DESC LIMIT 1",
"index": 1058,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Private Sector & Trade: Exports', 'Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncountry refers to CountryName;\nWhich country had the highest value of indicator belongs to Private Sector & Trade: Exports topic? Please list the country name and indicator 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 Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Upper middle income', 'Middle income', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Upper middle income', 'Middle income', 'Afghanistan', 'Albania']\n TableName text, -- example: ['Upper middle income', 'Middle income', 'Afghanistan', 'Albania']\n LongName text, -- example: ['Upper middle income', 'Middle income', 'Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Upper middle income', 'Low income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIndicatorName = 'CO2 emissions from liquid fuel consumption (% of total)'; less than 80% implies Value<80%; IncomeGroup = 'Upper middle income'; DIVIDE(COUNT(CountryCode where IndicatorName = 'CO2 emissions from liquid fuel consumption (% of total)'; Value<80%; IncomeGroup = 'Upper middle income'), COUNT(CountryCode where IncomeGroup = 'Upper middle income'));\nWhat percentage of upper middle income countries which have the CO2 emissions from liquid fuel consumption (% of total)\n\nless than 80%?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.IndicatorName = 'CO2 emissions FROM liquid fuel consumption (% of total)' AND t2.Value < 80 THEN 1 ELSE 0 END) * 1.0 / COUNT(T1.CountryCode) persent FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IncomeGroup = 'Upper middle income'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T2.IndicatorName = 'CO2 emissions FROM liquid fuel consumption (% of total)' AND t2.Value < 80 THEN 1 ELSE 0 END) * 1.0 / COUNT(T1.CountryCode) persent FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IncomeGroup = 'Upper middle income'",
"index": 1059,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Upper middle income', 'Middle income', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Upper middle income', 'Middle income', 'Afghanistan', 'Albania']\n TableName text, -- example: ['Upper middle income', 'Middle income', 'Afghanistan', 'Albania']\n LongName text, -- example: ['Upper middle income', 'Middle income', 'Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Upper middle income', 'Low income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIndicatorName = 'CO2 emissions from liquid fuel consumption (% of total)'; less than 80% implies Value<80%; IncomeGroup = 'Upper middle income'; DIVIDE(COUNT(CountryCode where IndicatorName = 'CO2 emissions from liquid fuel consumption (% of total)'; Value<80%; IncomeGroup = 'Upper middle income'), COUNT(CountryCode where IncomeGroup = 'Upper middle income'));\nWhat percentage of upper middle income countries which have the CO2 emissions from liquid fuel consumption (% of total)\n\nless than 80%?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Rural population', 'Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Rural population', 'Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n TableName text, -- example: ['Afghanistan', 'Albania']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n PRIMARY KEY (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIndicatorName = 'Rural population';\nWhat is indicator code of Rural population?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT IndicatorCode FROM Indicators WHERE IndicatorName = 'Rural population'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT DISTINCT IndicatorCode FROM Indicators WHERE IndicatorName = 'Rural population'",
"index": 1060,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Rural population', 'Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Rural population', 'Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n TableName text, -- example: ['Afghanistan', 'Albania']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n PRIMARY KEY (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIndicatorName = 'Rural population';\nWhat is indicator code of Rural population?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['US', 'AF', 'AL']\n CurrencyUnit text, -- example: ['Euro', 'Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['US', 'AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList out the series code of countries using Euro as their currency unit.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.SeriesCode FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T1.CurrencyUnit = 'Euro'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT DISTINCT T2.SeriesCode FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T1.CurrencyUnit = 'Euro'",
"index": 1061,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['US', 'AF', 'AL']\n CurrencyUnit text, -- example: ['Euro', 'Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['US', 'AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList out the series code of countries using Euro as their currency unit.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['DT.DOD.DSTC.CD', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n BasePeriod text, -- example: ['2005', 'varies by country']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n OtherWebLinks integer,\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['DT.DOD.DSTC.CD', 'EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['US', 'AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n Wb2Code text, -- world bank to code, example: ['US', 'AF', 'AL']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['DT.DOD.DSTC.CD', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList out the long name of countries using series code as DT.DOD.DSTC.CD\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.LongName FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T2.SeriesCode = 'DT.DOD.DSTC.CD'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT T1.LongName FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T2.SeriesCode = 'DT.DOD.DSTC.CD'",
"index": 1062,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['DT.DOD.DSTC.CD', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n BasePeriod text, -- example: ['2005', 'varies by country']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n OtherWebLinks integer,\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['DT.DOD.DSTC.CD', 'EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['US', 'AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n Wb2Code text, -- world bank to code, example: ['US', 'AF', 'AL']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['DT.DOD.DSTC.CD', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList out the long name of countries using series code as DT.DOD.DSTC.CD\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n Alpha2Code text, -- Alpha to Code, example: ['US', 'AF', 'AL']\n CurrencyUnit text, -- example: ['Hong Kong dollar', 'Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMention the series code of countries using Hong Kong dollar as their currency unit.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.SeriesCode FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T1.CurrencyUnit = 'Hong Kong dollar'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT T2.SeriesCode FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T1.CurrencyUnit = 'Hong Kong dollar'",
"index": 1063,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n Alpha2Code text, -- Alpha to Code, example: ['US', 'AF', 'AL']\n CurrencyUnit text, -- example: ['Hong Kong dollar', 'Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMention the series code of countries using Hong Kong dollar as their currency unit.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SP.DYN.TO65.MA.ZS', 'EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['SP.DYN.TO65.MA.ZS', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['SP.DYN.TO65.MA.ZS', 'DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['SP.DYN.TO65.MA.ZS', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Periodicity text, -- example: ['Annual']\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n TableName text, -- example: ['Afghanistan', 'Albania']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n PRIMARY KEY (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList out the table name of countries using series code as SP.DYN.TO65.MA.ZS\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.TableName FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T2.Seriescode = 'SP.DYN.TO65.MA.ZS'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT T1.TableName FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T2.Seriescode = 'SP.DYN.TO65.MA.ZS'",
"index": 1064,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SP.DYN.TO65.MA.ZS', 'EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['SP.DYN.TO65.MA.ZS', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['SP.DYN.TO65.MA.ZS', 'DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['SP.DYN.TO65.MA.ZS', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Periodicity text, -- example: ['Annual']\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n TableName text, -- example: ['Afghanistan', 'Albania']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n PRIMARY KEY (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList out the table name of countries using series code as SP.DYN.TO65.MA.ZS\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n Periodicity text, -- example: ['Annual']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Low income', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Low income', 'Afghanistan', 'Albania']\n LongName text, -- example: ['Low income', 'Islamic State of Afghanistan', 'Republic of Albania']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlower earning countries refer to IncomeGroup = 'Low income';\nList out the country name of lower earning countries\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.CountryName FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IncomeGroup = 'Low income'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT DISTINCT T2.CountryName FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IncomeGroup = 'Low income'",
"index": 1065,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n Periodicity text, -- example: ['Annual']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Low income', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Low income', 'Afghanistan', 'Albania']\n LongName text, -- example: ['Low income', 'Islamic State of Afghanistan', 'Republic of Albania']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlower earning countries refer to IncomeGroup = 'Low income';\nList out the country name of lower earning countries\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Upper middle income', 'Middle income', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n LongName text, -- example: ['Upper middle income', 'Middle income', 'Islamic State of Afghanistan', 'Republic of Albania']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Upper middle income', 'Low income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIncomeGroup = 'Upper middle income'; the earliest national account base year refers to MIN(NationalAccountsBaseYear); \n\nList out the country name of upper middle income group. Which country has the earliest national account base year? List out the region where this country locates.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.CountryName FROM indicators AS T1 INNER JOIN country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.IncomeGroup = 'Upper middle income' UNION SELECT longname FROM ( SELECT longname FROM country WHERE NationalAccountsBaseYear <> '' ORDER BY NationalAccountsBaseYear ASC LIMIT 1 )",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT DISTINCT T1.CountryName FROM indicators AS T1 INNER JOIN country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.IncomeGroup = 'Upper middle income' UNION SELECT longname FROM ( SELECT longname FROM country WHERE NationalAccountsBaseYear <> '' ORDER BY NationalAccountsBaseYear ASC LIMIT 1 )",
"index": 1066,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Upper middle income', 'Middle income', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n LongName text, -- example: ['Upper middle income', 'Middle income', 'Islamic State of Afghanistan', 'Republic of Albania']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Upper middle income', 'Low income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIncomeGroup = 'Upper middle income'; the earliest national account base year refers to MIN(NationalAccountsBaseYear); \n\nList out the country name of upper middle income group. Which country has the earliest national account base year? List out the region where this country locates.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['CAN', 'ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n OtherWebLinks integer,\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['CAN', 'ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['CAN', 'ABW', 'ADO']\n ShortName text, -- example: ['High income', 'Afghanistan', 'Albania']\n CurrencyUnit text, -- example: ['Euro', 'Afghan afghani', 'Albanian lek']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['High income', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['CAN', 'ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNon-OECD and OECD countries can be regarded as rich countries for those that are part of the High Income Group;\nList out the country code and country name of the rich countries using Euro as their currency unit\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.CountryCode, T2.CountryName FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.CurrencyUnit = 'Euro' AND (T1.IncomeGroup = 'High income: OECD' OR T1.IncomeGroup = 'High income: nonOECD')",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT DISTINCT T1.CountryCode, T2.CountryName FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.CurrencyUnit = 'Euro' AND (T1.IncomeGroup = 'High income: OECD' OR T1.IncomeGroup = 'High income: nonOECD')",
"index": 1067,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['CAN', 'ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n OtherWebLinks integer,\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['CAN', 'ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['CAN', 'ABW', 'ADO']\n ShortName text, -- example: ['High income', 'Afghanistan', 'Albania']\n CurrencyUnit text, -- example: ['Euro', 'Afghan afghani', 'Albanian lek']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['High income', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['CAN', 'ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNon-OECD and OECD countries can be regarded as rich countries for those that are part of the High Income Group;\nList out the country code and country name of the rich countries using Euro as their currency unit\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 CountryCode text, -- example: ['ABW', 'ADO']\n TableName text, -- example: ['Afghanistan', 'Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['FP.CPI.TOTL', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['FP.CPI.TOTL', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['FP.CPI.TOTL', 'EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList out the table name and currency unit of countries using series code as FP.CPI.TOTL\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.TableName, T1.CurrencyUnit FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T2.SeriesCode = 'FP.CPI.TOTL'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT T1.TableName, T1.CurrencyUnit FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T2.SeriesCode = 'FP.CPI.TOTL'",
"index": 1068,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 CountryCode text, -- example: ['ABW', 'ADO']\n TableName text, -- example: ['Afghanistan', 'Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['FP.CPI.TOTL', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['FP.CPI.TOTL', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['FP.CPI.TOTL', 'EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList out the table name and currency unit of countries using series code as FP.CPI.TOTL\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n TableName text, -- example: ['High income: nonOECD', 'High income', 'Afghanistan', 'Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['High income: nonOECD', 'Low income', 'Upper middle income']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['High income: nonOECD', 'High income', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhigh income: non-OECD' refer to IncomeGroup;\nList out the name and indicator code of high income: nonOECD countries\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.CountryCode, T2.CountryName FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IncomeGroup = 'High income: nonOECD'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT DISTINCT T1.CountryCode, T2.CountryName FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IncomeGroup = 'High income: nonOECD'",
"index": 1069,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n TableName text, -- example: ['High income: nonOECD', 'High income', 'Afghanistan', 'Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['High income: nonOECD', 'Low income', 'Upper middle income']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['High income: nonOECD', 'High income', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhigh income: non-OECD' refer to IncomeGroup;\nList out the name and indicator code of high income: nonOECD countries\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncountries name starts with alphabet A refers to shortname like 'A%';\nHow many of the countries name start with alphabet A? List down the Alpha2Code of them.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(ShortName) FROM Country WHERE ShortName LIKE 'A%' UNION SELECT alpha2code FROM country WHERE shortname LIKE 'A%'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT COUNT(ShortName) FROM Country WHERE ShortName LIKE 'A%' UNION SELECT alpha2code FROM country WHERE shortname LIKE 'A%'",
"index": 1070,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncountries name starts with alphabet A refers to shortname like 'A%';\nHow many of the countries name start with alphabet A? List down the Alpha2Code of them.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['DO', 'AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['DO', 'AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndo not have special notes implies SpecialNotes are NULL;\nHow many of the countries do not have special notes? List the long 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 COUNT(LongName) FROM Country WHERE SpecialNotes = '' UNION SELECT longname FROM country WHERE specialnotes = ''",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT COUNT(LongName) FROM Country WHERE SpecialNotes = '' UNION SELECT longname FROM country WHERE specialnotes = ''",
"index": 1071,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['DO', 'AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['DO', 'AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndo not have special notes implies SpecialNotes are NULL;\nHow many of the countries do not have special notes? List the long 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 Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['High income', 'Afghanistan', 'Albania']\n TableName text, -- example: ['High income', 'Afghanistan', 'Albania']\n LongName text, -- example: ['High income', 'Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAsia is the name of the region;\nWhich high income group countries are from Asia?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CountryCode, Region FROM Country WHERE (IncomeGroup = 'High income: OECD' OR IncomeGroup = 'High income: nonOECD') AND Region LIKE '%Asia%'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT CountryCode, Region FROM Country WHERE (IncomeGroup = 'High income: OECD' OR IncomeGroup = 'High income: nonOECD') AND Region LIKE '%Asia%'",
"index": 1072,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['High income', 'Afghanistan', 'Albania']\n TableName text, -- example: ['High income', 'Afghanistan', 'Albania']\n LongName text, -- example: ['High income', 'Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAsia is the name of the region;\nWhich high income group countries are from Asia?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n PRIMARY KEY (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnational accounts base year prior to 1980 means before 1980 and refers to NationalAccountsBaseYear<1980;\nName the countries' long name with national accounts base year prior to 1980.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT LongName FROM Country WHERE NationalAccountsBaseYear < '1980' AND NationalAccountsBaseYear != ''",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT LongName FROM Country WHERE NationalAccountsBaseYear < '1980' AND NationalAccountsBaseYear != ''",
"index": 1073,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n PRIMARY KEY (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnational accounts base year prior to 1980 means before 1980 and refers to NationalAccountsBaseYear<1980;\nName the countries' long name with national accounts base year prior to 1980.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['DT.DOD.DECT.CD', 'AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n TableName text, -- example: ['Low income', 'Afghanistan', 'Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['DT.DOD.DECT.CD', 'EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['DT.DOD.DECT.CD', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n UnitOfMeasure text, -- example: ['`', '%']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Low income', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['DT.DOD.DECT.CD', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIncomeGroup = 'Low income';\nWhich low income country has a series code of DT.DOD.DECT.CD? Name the country code of it.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.CountryCode FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T1.IncomeGroup = 'Low income' AND T2.Seriescode = 'DT.DOD.DECT.CD'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT T1.CountryCode FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T1.IncomeGroup = 'Low income' AND T2.Seriescode = 'DT.DOD.DECT.CD'",
"index": 1074,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['DT.DOD.DECT.CD', 'AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n TableName text, -- example: ['Low income', 'Afghanistan', 'Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['DT.DOD.DECT.CD', 'EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['DT.DOD.DECT.CD', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n UnitOfMeasure text, -- example: ['`', '%']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Low income', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['DT.DOD.DECT.CD', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIncomeGroup = 'Low income';\nWhich low income country has a series code of DT.DOD.DECT.CD? Name the country code of it.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n Periodicity text, -- example: ['Annual']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n OtherWebLinks integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Finland', 'Afghanistan', 'Albania']\n TableName text, -- example: ['Finland', 'Afghanistan', 'Albania']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['yr2000', 'YR2000', 'YR1990']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2000', 'YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFinland is the short name of the country; year 2000 refers to Year = 'YR2000';\nWhat are the footnote description of Finland in year 2000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.Description FROM Country AS T1 INNER JOIN FootNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T1.TableName = 'Finland' AND T2.Year = 'YR2000'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT DISTINCT T2.Description FROM Country AS T1 INNER JOIN FootNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T1.TableName = 'Finland' AND T2.Year = 'YR2000'",
"index": 1075,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n Periodicity text, -- example: ['Annual']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n OtherWebLinks integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Finland', 'Afghanistan', 'Albania']\n TableName text, -- example: ['Finland', 'Afghanistan', 'Albania']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['yr2000', 'YR2000', 'YR1990']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2000', 'YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFinland is the short name of the country; year 2000 refers to Year = 'YR2000';\nWhat are the footnote description of Finland in year 2000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Air transport, passengers carried', 'Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Air transport, passengers carried', 'Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat are the years when countries have indicator name of \"Air transport, passengers carried\"? List the table name of these countries.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.Year, T1.TableName FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.IndicatorName = 'Air transport, passengers carried'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT DISTINCT T2.Year, T1.TableName FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.IndicatorName = 'Air transport, passengers carried'",
"index": 1076,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Air transport, passengers carried', 'Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Air transport, passengers carried', 'Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat are the years when countries have indicator name of \"Air transport, passengers carried\"? List the table name of these countries.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n Periodicity text, -- example: ['Annual']\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwith any indicator name implies IndicatorName is not NULL; Year = '1980';\nList the long name of countries with indicator name in 1980.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.LongName FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.Year = 1980 AND T2.IndicatorName IS NOT NULL",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT DISTINCT T1.LongName FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.Year = 1980 AND T2.IndicatorName IS NOT NULL",
"index": 1077,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n Periodicity text, -- example: ['Annual']\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwith any indicator name implies IndicatorName is not NULL; Year = '1980';\nList the long name of countries with indicator name in 1980.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Data sources : Eurostat', 'Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList the series code of country with country notes description as \"Data sources : Eurostat\" and state the Wb2Code of these countries.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.seriescode, T1.Wb2Code FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T2.Description = 'Data sources : Eurostat'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT T2.seriescode, T1.Wb2Code FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T2.Description = 'Data sources : Eurostat'",
"index": 1078,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Data sources : Eurostat', 'Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList the series code of country with country notes description as \"Data sources : Eurostat\" and state the Wb2Code of these countries.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 CountryCode text, -- example: ['PER', 'ABW', 'ADO']\n ShortName text, -- example: ['Low income', 'Afghanistan', 'Albania']\n TableName text, -- example: ['Low income', 'Afghanistan', 'Albania']\n LongName text, -- example: ['Low income', 'Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AG', 'AF', 'AL']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AG', 'AF', 'AL']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Low income', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['PER', 'ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfertility rate refers to IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)'; lowest refers to MIN(Value); IncomeGroup = 'Low income';\nAmong the low income countries, which country has the lowest fertility rate?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.CountryName FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IncomeGroup = 'Low income' AND T2.IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)' ORDER BY T2.Value LIMIT 1",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT T2.CountryName FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IncomeGroup = 'Low income' AND T2.IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)' ORDER BY T2.Value LIMIT 1",
"index": 1079,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 CountryCode text, -- example: ['PER', 'ABW', 'ADO']\n ShortName text, -- example: ['Low income', 'Afghanistan', 'Albania']\n TableName text, -- example: ['Low income', 'Afghanistan', 'Albania']\n LongName text, -- example: ['Low income', 'Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AG', 'AF', 'AL']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AG', 'AF', 'AL']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Low income', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['PER', 'ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfertility rate refers to IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)'; lowest refers to MIN(Value); IncomeGroup = 'Low income';\nAmong the low income countries, which country has the lowest fertility rate?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Urban population', 'Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Urban population', 'Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n Periodicity text, -- example: ['Annual']\n OtherNotes integer,\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n OtherWebLinks integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIncomeGroup = 'Middle income'; Year = 1960; urban population refers to IndicatorName;\nHow much is the total urban population of middle income countries in 1960?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T2.Value) FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IncomeGroup LIKE '%middle income' AND T2.Year = 1960 AND T2.IndicatorName = 'Urban population'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT SUM(T2.Value) FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IncomeGroup LIKE '%middle income' AND T2.Year = 1960 AND T2.IndicatorName = 'Urban population'",
"index": 1080,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Urban population', 'Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Urban population', 'Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n Periodicity text, -- example: ['Annual']\n OtherNotes integer,\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n OtherWebLinks integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIncomeGroup = 'Middle income'; Year = 1960; urban population refers to IndicatorName;\nHow much is the total urban population of middle income countries in 1960?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n Wb2Code text, -- world bank to code, example: ['US', 'AF', 'AL']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfastest growth refers to MAX(Value); IndicatorName = 'Adjusted net national income (annual % growth)'; Year = '1980'; currency refers to CurrencyUnit;\nName the country with fastest growth in adjusted net national income in 1980 and state the currency used by this country.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.countryname, T1.CurrencyUnit FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.IndicatorName = 'Adjusted net national income (annual % growth)' AND T2.Year = 1980 AND T1.CurrencyUnit != '' ORDER BY T2.Value DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT T2.countryname, T1.CurrencyUnit FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.IndicatorName = 'Adjusted net national income (annual % growth)' AND T2.Year = 1980 AND T1.CurrencyUnit != '' ORDER BY T2.Value DESC LIMIT 1",
"index": 1081,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n Wb2Code text, -- world bank to code, example: ['US', 'AF', 'AL']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfastest growth refers to MAX(Value); IndicatorName = 'Adjusted net national income (annual % growth)'; Year = '1980'; currency refers to CurrencyUnit;\nName the country with fastest growth in adjusted net national income in 1980 and state the currency used by this country.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['US', 'AF', 'AL']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['US', 'AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n UnitOfMeasure text, -- example: ['`', '%']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nuse the 1993 System of National Accounts methodology refers to SystemOfNationalAccounts = '1993 System of National Accounts methodology.'\nHow many countries using the 1993 System of National Accounts methodology?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(CountryCode) FROM Country WHERE SystemOfNationalAccounts = 'Country uses the 1993 System of National Accounts methodology.'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT COUNT(CountryCode) FROM Country WHERE SystemOfNationalAccounts = 'Country uses the 1993 System of National Accounts methodology.'",
"index": 1082,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['US', 'AF', 'AL']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['US', 'AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n UnitOfMeasure text, -- example: ['`', '%']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nuse the 1993 System of National Accounts methodology refers to SystemOfNationalAccounts = '1993 System of National Accounts methodology.'\nHow many countries using the 1993 System of National Accounts methodology?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n OtherNotes integer,\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n OtherWebLinks integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n PRIMARY KEY (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave completed vital registration refers to VitalRegistrationComplete = Yes; country name refers to ShortName\nWhich country have completed vital registration? List all the countries.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT ShortName FROM Country WHERE VitalRegistrationComplete = 'Yes'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT ShortName FROM Country WHERE VitalRegistrationComplete = 'Yes'",
"index": 1083,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n OtherNotes integer,\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n OtherWebLinks integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n PRIMARY KEY (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave completed vital registration refers to VitalRegistrationComplete = Yes; country name refers to ShortName\nWhich country have completed vital registration? List all the countries.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['YE', 'AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Census.', 'Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom 2010 until 2012 refers to LatestPopulationCensus between '2010' and '2012'; have completed vital registration refers to VitalRegistrationComplete = 'Yes'; CountryName = ShortName + LongName\nWhich country have conducted population census from 2010 until 2012 and have completed vital registration?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT ShortName, LongName FROM Country WHERE LatestPopulationCensus >= 2010 AND LatestPopulationCensus < 2013 AND VitalRegistrationComplete = 'Yes'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT ShortName, LongName FROM Country WHERE LatestPopulationCensus >= 2010 AND LatestPopulationCensus < 2013 AND VitalRegistrationComplete = 'Yes'",
"index": 1084,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['YE', 'AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Census.', 'Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom 2010 until 2012 refers to LatestPopulationCensus between '2010' and '2012'; have completed vital registration refers to VitalRegistrationComplete = 'Yes'; CountryName = ShortName + LongName\nWhich country have conducted population census from 2010 until 2012 and have completed vital registration?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['PER', 'TON', 'ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['PER', 'TON', 'ABW', 'ADO']\n IndicatorName text, -- example: ['CO2 emissions (metric tons per capita)', 'Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['CO2 emissions (metric tons per capita)', 'Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['PER', 'TON', 'ABW', 'ADO']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['PER', 'TON', 'ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwhich country refers to countryname; the highest CO2 emissions refers to max(value where indicatorname = 'CO2 emissions (metric tons per capita)'); in 1960 refers to year = '1970'\nWhich country have the highest CO2 emissions in 1960?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CountryName FROM Indicators WHERE Year = 1960 AND IndicatorName = 'CO2 emissions (metric tons per capita)' ORDER BY Value DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT CountryName FROM Indicators WHERE Year = 1960 AND IndicatorName = 'CO2 emissions (metric tons per capita)' ORDER BY Value DESC LIMIT 1",
"index": 1085,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['PER', 'TON', 'ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['PER', 'TON', 'ABW', 'ADO']\n IndicatorName text, -- example: ['CO2 emissions (metric tons per capita)', 'Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['CO2 emissions (metric tons per capita)', 'Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['PER', 'TON', 'ABW', 'ADO']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['PER', 'TON', 'ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwhich country refers to countryname; the highest CO2 emissions refers to max(value where indicatorname = 'CO2 emissions (metric tons per capita)'); in 1960 refers to year = '1970'\nWhich country have the highest CO2 emissions in 1960?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Estimate', 'Actual', 'Preliminary']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Estimates', 'Estimate', 'Estimates.', 'Estimate.', 'Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Estimates are based on regression.', 'Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwhat country refers to LongName; have its data estimated based on regression refers to description = 'Estimates are based on regression.'\nWhat country have its data estimated based on regression?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.ShortName FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T2.Description = 'Estimates are based on regression.'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT DISTINCT T1.ShortName FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T2.Description = 'Estimates are based on regression.'",
"index": 1086,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Estimate', 'Actual', 'Preliminary']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Estimates', 'Estimate', 'Estimates.', 'Estimate.', 'Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Estimates are based on regression.', 'Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwhat country refers to LongName; have its data estimated based on regression refers to description = 'Estimates are based on regression.'\nWhat country have its data estimated based on regression?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Urban population', 'Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n OtherWebLinks integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Urban population', 'Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Region text, -- example: ['East Asia & Pacific', 'South Asia', 'Europe & Central Asia']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncountry refers to LongName; have more than 2000000 urban population refers to value where indicatorname = 'Urban population'>2000000; in 1970 refers to year = '1970'\nList all the country in East Asia & Pacific region that have more than 2000000 urban population in 1970.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.CountryCode FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.Year = 1970 AND T1.Region = 'East Asia & Pacific' AND T2.Value > 2000000 AND t2.indicatorname = 'Urban population'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT DISTINCT T1.CountryCode FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.Year = 1970 AND T1.Region = 'East Asia & Pacific' AND T2.Value > 2000000 AND t2.indicatorname = 'Urban population'",
"index": 1087,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Urban population', 'Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n OtherWebLinks integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Urban population', 'Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Region text, -- example: ['East Asia & Pacific', 'South Asia', 'Europe & Central Asia']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncountry refers to LongName; have more than 2000000 urban population refers to value where indicatorname = 'Urban population'>2000000; in 1970 refers to year = '1970'\nList all the country in East Asia & Pacific region that have more than 2000000 urban population in 1970.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['US', 'AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['US', 'AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nuses the 1968 System of National Accounts methodology refers to SystemOfNationalAccounts = '1968 System of National Accounts methodology'\nHow many countries uses the 1968 System of National Accounts methodology?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(CountryCode) FROM Country WHERE SystemOfNationalAccounts = 'Country uses the 1968 System of National Accounts methodology.'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT COUNT(CountryCode) FROM Country WHERE SystemOfNationalAccounts = 'Country uses the 1968 System of National Accounts methodology.'",
"index": 1088,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['US', 'AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['US', 'AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nuses the 1968 System of National Accounts methodology refers to SystemOfNationalAccounts = '1968 System of National Accounts methodology'\nHow many countries uses the 1968 System of National Accounts methodology?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Upper middle income', 'Middle income', 'Afghanistan', 'Albania']\n Region text, -- example: ['East Asia & Pacific', 'South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Upper middle income', 'Low income']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Social Protection & Labor: Migration', 'Economic Policy & Debt: Balance of payme']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nupper middle income country refers to incomegroup = 'Upper middle income'\nWhat upper middle income country under East Asia & Pacific region which covers the topic about Social Protection & Labor: Migration\n? Indicate the short name of the said country.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.ShortName FROM Country AS T1 INNER JOIN footnotes AS T2 ON T1.CountryCode = T2.CountryCode INNER JOIN Series AS T3 ON T2.Seriescode = T3.SeriesCode WHERE T1.IncomeGroup = 'Upper middle income' AND T1.Region = 'East Asia & Pacific' AND T3.Topic = 'Social Protection & Labor: Migration'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT DISTINCT T1.ShortName FROM Country AS T1 INNER JOIN footnotes AS T2 ON T1.CountryCode = T2.CountryCode INNER JOIN Series AS T3 ON T2.Seriescode = T3.SeriesCode WHERE T1.IncomeGroup = 'Upper middle income' AND T1.Region = 'East Asia & Pacific' AND T3.Topic = 'Social Protection & Labor: Migration'",
"index": 1089,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Upper middle income', 'Middle income', 'Afghanistan', 'Albania']\n Region text, -- example: ['East Asia & Pacific', 'South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Upper middle income', 'Low income']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Social Protection & Labor: Migration', 'Economic Policy & Debt: Balance of payme']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nupper middle income country refers to incomegroup = 'Upper middle income'\nWhat upper middle income country under East Asia & Pacific region which covers the topic about Social Protection & Labor: Migration\n? Indicate the short name of the said country.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Poverty: Shared prosperity', 'Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nName the country in which the topic is about Poverty: Shared Prosperity. Indicate the long name of the country.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.LongName FROM Country AS T1 INNER JOIN footnotes AS T2 ON T1.CountryCode = T2.Countrycode INNER JOIN Series AS T3 ON T2.Seriescode = T3.SeriesCode WHERE T3.Topic = 'Poverty: Shared prosperity'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT DISTINCT T1.LongName FROM Country AS T1 INNER JOIN footnotes AS T2 ON T1.CountryCode = T2.Countrycode INNER JOIN Series AS T3 ON T2.Seriescode = T3.SeriesCode WHERE T3.Topic = 'Poverty: Shared prosperity'",
"index": 1090,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Poverty: Shared prosperity', 'Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nName the country in which the topic is about Poverty: Shared Prosperity. Indicate the long name of the country.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Series (\n SeriesCode text, -- example: ['SP.DYN.AMRT.FE', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n OtherWebLinks integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SP.DYN.AMRT.FE', 'EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Sub-Saharan Africa', 'Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['Sub-Saharan Africa', 'South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['SP.DYN.AMRT.FE', 'DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SP.DYN.AMRT.FE', 'AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['SP.DYN.AMRT.FE', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat country in the region of Sub-Saharan Africa has a series code of \"SP.DYN.AMRT.FE\"? Indicate the long name of the country\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T3.LongName FROM SeriesNotes AS T1 INNER JOIN CountryNotes AS T2 ON T1.SeriesCode = T2.Seriescode INNER JOIN Country AS T3 ON T2.Countrycode = T3.CountryCode WHERE T3.Region = 'Sub-Saharan Africa' AND T1.SeriesCode = 'SP.DYN.AMRT.FE'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT DISTINCT T3.LongName FROM SeriesNotes AS T1 INNER JOIN CountryNotes AS T2 ON T1.SeriesCode = T2.Seriescode INNER JOIN Country AS T3 ON T2.Countrycode = T3.CountryCode WHERE T3.Region = 'Sub-Saharan Africa' AND T1.SeriesCode = 'SP.DYN.AMRT.FE'",
"index": 1091,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Series (\n SeriesCode text, -- example: ['SP.DYN.AMRT.FE', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n OtherWebLinks integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SP.DYN.AMRT.FE', 'EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Sub-Saharan Africa', 'Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['Sub-Saharan Africa', 'South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['SP.DYN.AMRT.FE', 'DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SP.DYN.AMRT.FE', 'AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['SP.DYN.AMRT.FE', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat country in the region of Sub-Saharan Africa has a series code of \"SP.DYN.AMRT.FE\"? Indicate the long name of the country\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n OtherWebLinks integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n SystemOfTrade text, -- example: ['Special trade system', 'General trade system']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n PRIMARY KEY (CountryCode)\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 longname; using special trade system refers to systemoftrade = 'Special trade system'\nPlease provide full name of any two countries using special trade system.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT LongName FROM Country WHERE SystemOfTrade = 'Special trade system' LIMIT 2",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT LongName FROM Country WHERE SystemOfTrade = 'Special trade system' LIMIT 2",
"index": 1092,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n OtherWebLinks integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n SystemOfTrade text, -- example: ['Special trade system', 'General trade system']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n PRIMARY KEY (CountryCode)\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 longname; using special trade system refers to systemoftrade = 'Special trade system'\nPlease provide full name of any two countries using special trade system.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Preliminary', 'Preliminary.', 'Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Upper middle income', 'Middle income', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Upper middle income', 'Middle income', 'Afghanistan', 'Albania']\n LongName text, -- example: ['Upper middle income', 'Middle income', 'Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Upper middle income', 'Low income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Preliminary', 'Actual']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin the upper middle income category refers to incomegroup = 'Upper middle income'; still have unfinished external debt reporting refers to ExternalDebtReportingStatus = 'Preliminary'\nWhich countries in the upper middle income category still have unfinished external debt reporting? Please provide the country codes in your answer.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CountryCode FROM Country WHERE IncomeGroup = 'Upper middle income' AND ExternalDebtReportingStatus = 'Preliminary'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT CountryCode FROM Country WHERE IncomeGroup = 'Upper middle income' AND ExternalDebtReportingStatus = 'Preliminary'",
"index": 1093,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Preliminary', 'Preliminary.', 'Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Upper middle income', 'Middle income', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Upper middle income', 'Middle income', 'Afghanistan', 'Albania']\n LongName text, -- example: ['Upper middle income', 'Middle income', 'Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Upper middle income', 'Low income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Preliminary', 'Actual']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin the upper middle income category refers to incomegroup = 'Upper middle income'; still have unfinished external debt reporting refers to ExternalDebtReportingStatus = 'Preliminary'\nWhich countries in the upper middle income category still have unfinished external debt reporting? Please provide the country codes in your answer.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n TableName text, -- example: ['Middle East & North Africa', 'Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['Middle East & North Africa', 'South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage = divide(count(countrycode where ExternalDebtReportingStatus = 'Actual' ), count(countrycode))*100%; in the Middle East and North Africa refers to region = 'Middle East & North Africa'; have finished reporting on their real external debt refers to ExternalDebtReportingStatus = 'Actual'\nWhat is the percentage of countries in the Middle East and North Africa that have finished reporting on their real external debt?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 ExternalDebtReportingStatus = 'Actual' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(CountryCode) FROM Country WHERE region = 'Middle East & North Africa'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN ExternalDebtReportingStatus = 'Actual' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(CountryCode) FROM Country WHERE region = 'Middle East & North Africa'",
"index": 1094,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n TableName text, -- example: ['Middle East & North Africa', 'Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['Middle East & North Africa', 'South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage = divide(count(countrycode where ExternalDebtReportingStatus = 'Actual' ), count(countrycode))*100%; in the Middle East and North Africa refers to region = 'Middle East & North Africa'; have finished reporting on their real external debt refers to ExternalDebtReportingStatus = 'Actual'\nWhat is the percentage of countries in the Middle East and North Africa that have finished reporting on their real external debt?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n OtherWebLinks integer,\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\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 longname\nPlease list the full names of any three countries that have their series code with a description of UN Energy Statistics (2014).\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.LongName FROM CountryNotes AS T1 INNER JOIN Country AS T2 ON T1.Countrycode = T2.CountryCode WHERE T1.Description = 'Sources: UN Energy Statistics (2014)' LIMIT 3",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT DISTINCT T2.LongName FROM CountryNotes AS T1 INNER JOIN Country AS T2 ON T1.Countrycode = T2.CountryCode WHERE T1.Description = 'Sources: UN Energy Statistics (2014)' LIMIT 3",
"index": 1095,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n OtherWebLinks integer,\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\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 longname\nPlease list the full names of any three countries that have their series code with a description of UN Energy Statistics (2014).\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Germany', 'Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGermany refers to shortname = 'Germany'\nWhat is the series code for Germany and what is its description?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Seriescode, T1.Description FROM CountryNotes AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.ShortName = 'Germany'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT T1.Seriescode, T1.Description FROM CountryNotes AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.ShortName = 'Germany'",
"index": 1096,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Germany', 'Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGermany refers to shortname = 'Germany'\nWhat is the series code for Germany and what is its description?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Austria', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Austria', 'Afghanistan', 'Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsubject refers to topic; Austria refers to shortname = 'Austria'\nPlease provide the subject of series of Austria.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T3.Topic FROM CountryNotes AS T1 INNER JOIN Country AS T2 ON T1.Countrycode = T2.CountryCode INNER JOIN Series AS T3 ON T1.Seriescode = T3.SeriesCode WHERE T2.ShortName = 'Austria'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT DISTINCT T3.Topic FROM CountryNotes AS T1 INNER JOIN Country AS T2 ON T1.Countrycode = T2.CountryCode INNER JOIN Series AS T3 ON T1.Seriescode = T3.SeriesCode WHERE T2.ShortName = 'Austria'",
"index": 1097,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Austria', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Austria', 'Afghanistan', 'Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsubject refers to topic; Austria refers to shortname = 'Austria'\nPlease provide the subject of series of Austria.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Series (\n SeriesCode text, -- example: ['SP.DYN.AMRT.MA', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['SP.DYN.AMRT.MA', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SP.DYN.AMRT.MA', 'AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SP.DYN.AMRT.MA', 'EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['SP.DYN.AMRT.MA', 'DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsubject refers to topic; pertain to refers to Description\nWhat is the subject of the series SP.DYN.AMRT.MA and what does it pertain to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.Topic, T2.Description FROM Series AS T1 INNER JOIN SeriesNotes AS T2 ON T1.SeriesCode = T2.Seriescode WHERE T1.SeriesCode = 'SP.DYN.AMRT.MA'",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT DISTINCT T1.Topic, T2.Description FROM Series AS T1 INNER JOIN SeriesNotes AS T2 ON T1.SeriesCode = T2.Seriescode WHERE T1.SeriesCode = 'SP.DYN.AMRT.MA'",
"index": 1098,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Series (\n SeriesCode text, -- example: ['SP.DYN.AMRT.MA', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['SP.DYN.AMRT.MA', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SP.DYN.AMRT.MA', 'AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['SP.DYN.AMRT.MA', 'EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['SP.DYN.AMRT.MA', 'DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsubject refers to topic; pertain to refers to Description\nWhat is the subject of the series SP.DYN.AMRT.MA and what does it pertain to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndescribed as \"unspecified\" refers to Description = 'Not specified'; full names refers to LongName\nHow many countries are having their country's footnotes described as \"unspecified\"? Please provide the full names of any three of those countries.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DISTINCT T1.CountryCode) FROM Country AS T1 INNER JOIN Footnotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T2.Description = 'Unspecified' OR T2.Description = 'Not specified' UNION SELECT T1.LongName FROM Country AS T1 INNER JOIN Footnotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T2.Description = 'Unspecified' OR T2.Description = 'Not specified' LIMIT 4",
"style": "rule"
} | {
"db_id": "world_development_indicators.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T1.CountryCode) FROM Country AS T1 INNER JOIN Footnotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T2.Description = 'Unspecified' OR T2.Description = 'Not specified' UNION SELECT T1.LongName FROM Country AS T1 INNER JOIN Footnotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T2.Description = 'Unspecified' OR T2.Description = 'Not specified' LIMIT 4",
"index": 1099,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndescribed as \"unspecified\" refers to Description = 'Not specified'; full names refers to LongName\nHow many countries are having their country's footnotes described as \"unspecified\"? Please provide the full names of any three of those countries.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\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.