Chinastark/bird_dataset huggingface dataset:
Database: professional_basketball
Note: the Most improved Player refers to award = 'Most Improved Player'; from 1985-1990 refers to year between 1985 and 1990; country is USA refers to birthcountry = 'USA';
Question: Among the Most improved Players awarded from 1985-1990, how many player whose country is USA?
SQL: SELECT count(DISTINCT players.playerid) FROM awards_players INNER JOIN players ON awards_players.playerid = players.playerid WHERE awards_players.award = 'Most Improved Player' AND players.birthcountry = 'USA' AND awards_players.year BETWEEN 1985 AND 1990
Database: professional_basketball
Note: California college refers to college = 'California';
Question: Please list out the first name and last name of player who attended California college and have been selected as all stars?
SQL: SELECT DISTINCT players.firstname, players.lastname FROM players INNER JOIN player_allstar ON players.playerid = player_allstar.playerid WHERE players.college = 'California'
Database: professional_basketball
Note: from 1950 to 1970 refers to year between 1950 and 1970; more than 3 awards refers to count(award) > 3;
Question: From 1950 to 1970, how many coaches who received more than 1 award?
SQL: SELECT count(coachid) FROM awards_coaches WHERE YEAR BETWEEN 1950 AND 1970 GROUP BY coachid HAVING count(coachid) > 1
Database: professional_basketball
Note: Most Valuable Player award refers to award = 'Most Valuable Player'; from 1969 to 1975 refers to year between 1969 and 1975;
Question: How many players received Most Valuable Player award from 1969 to 1975?
SQL: SELECT count(DISTINCT playerid) FROM awards_players WHERE YEAR BETWEEN 1969 AND 1975 AND award = 'Most Valuable Player'
Database: professional_basketball
Note: team name refers to teams.name; state that a player is born refers to birthstate;
Question: Please list the team names which have at least 5 players were born in the same state.
SQL: SELECT DISTINCT name FROM teams WHERE tmid IN ( SELECT tmid FROM players_teams INNER JOIN players ON players_teams.playerid = players.playerid WHERE players.birthstate IS NOT NULL GROUP BY players_teams.tmid, players.birthstate HAVING count(*) > 5 )
Database: professional_basketball
Note: NBA refers to lgid = 'NBA'; have at least 3 all-star players refers to count(player_allstar.playerid) > 3;
Question: How many teams in the NBA which has at least 3 all-star players?
SQL: SELECT count(*) FROM ( SELECT tmid FROM players_teams INNER JOIN player_allstar ON players_teams.playerid = player_allstar.playerid WHERE players_teams.lgid = 'NBA' GROUP BY players_teams.tmid HAVING count(DISTINCT players_teams.playerid) > 3 ) AS t3
Database: professional_basketball
Note: state refers to birthstate; the most players refers to max(count(playerid));
Question: Which state has the most players selected as all stars?
SQL: SELECT players.birthstate FROM players INNER JOIN player_allstar ON players.playerid = player_allstar.playerid GROUP BY players.birthstate ORDER BY count(DISTINCT players.playerid) DESC LIMIT 1
Database: professional_basketball
Note: ranked 6 refers to rank = 6; in 1937 refers to year = 1937;
Question: How many players whose teams were ranked 6 in 1937?
SQL: SELECT count(DISTINCT players.playerid) FROM players INNER JOIN players_teams ON players.playerid = players_teams.playerid INNER JOIN teams ON teams.tmid = players_teams.tmid WHERE teams.year = 1937 AND teams.rank = 6
Database: professional_basketball
Note: in 1950 refers to year = 1950; losing rate less than 20% refers to divide(lost, add(won, lost)) < 0.2;
Question: In 1950, how many players whose teams have the losing rate less than 20%?
SQL: SELECT count(DISTINCT players.playerid) FROM players INNER JOIN players_teams ON players.playerid = players_teams.playerid INNER JOIN teams ON teams.tmid = players_teams.tmid WHERE cast(teams.lost AS REAL) * 100 / (teams.lost + teams.won) < 20
Database: professional_basketball
Note: full name refers to firstname, middlename, lastname; born outside USA refers to birthcountry ! = 'USA';
Question: List the full name of players who are born outside USA.
SQL: SELECT firstname, middlename, lastname FROM players WHERE birthcountry != 'USA'
Database: professional_basketball
Note: more than 2 different teams refers to count(tmid) > 2;
Question: List out all the coach ID who have served more than 2 different teams.
SQL: SELECT coachid FROM coaches GROUP BY coachid HAVING count(DISTINCT tmid) > 2
Database: professional_basketball
Note: in year '1988' refers to year = 1988; the most 'won' than 'lost' refers to max(subtract(won, lost));
Question: Which coach has the most 'won' than 'lost' in year '1988'?
SQL: SELECT coachid FROM coaches WHERE YEAR = 1988 ORDER BY won - lost DESC LIMIT 1
Database: professional_basketball
Note: team name refers to teams.name; won the title 'NBA Coach of the year' refers to award = 'NBA Coach of the year'; in 2010 refers to year = 2010;
Question: Name the team in which the coach won the title 'NBA Coach of the Year' in 2010.
SQL: SELECT DISTINCT coaches.tmid FROM coaches INNER JOIN awards_coaches ON coaches.coachid = awards_coaches.coachid WHERE awards_coaches.year = 2010 AND awards_coaches.award = 'NBA Coach of the Year'
Database: professional_basketball
Note: all free throw attempted successfully made refers to ftattempted > 0 and ftattempted = ftmade;
Question: List the first name, last name, height and weight of the players who has all free throw attempted successfully made.
SQL: SELECT DISTINCT players.firstname, players.lastname, players.height, players.weight FROM players INNER JOIN player_allstar ON players.playerid = player_allstar.playerid WHERE player_allstar.ft_attempted > 0 AND ft_attempted = ft_made
Database: professional_basketball
Note: team name refers to teams.name; drafted from 'Seattle' refers to draftfrom = 'Seattle'; between year 1965 to 1970 refers to draftyear between 1965 and 1970;
Question: List the first name, last name and team name of players who are drafted from 'Seattle' between year 1965 to 1970.
SQL: SELECT DISTINCT players.firstname, players.lastname, teams.name FROM players INNER JOIN draft ON players.playerid = draft.playerid INNER JOIN teams ON draft.tmid = teams.tmid WHERE draft.draftfrom = 'Seattle' AND draft.draftyear BETWEEN 1965 AND 1970
Database: professional_basketball
Note: full name refers to firstname, middlename, lastname; age = subtract(2003, year(birthdate)); won the "Finals MVP" refers to award = 'Finals MVP'; in 2003 refers to year = 2003;
Question: List the full name and age of the player when he won the "Finals MVP" in 2003.
SQL: SELECT players.firstname, players.middlename, players.lastname , 2003 - strftime('%Y', players.birthdate) FROM awards_players JOIN players ON awards_players.playerid = players.playerid WHERE awards_players.award = 'Finals MVP' AND awards_players.year = 2003
Database: professional_basketball
Note: champion refers to round = 'F'; team name refers to teams.name; from year 1950 to 1960 refers to year between 1950 and 1960;
Question: List the champion (team name) and year from year 1950 to 1960.
SQL: SELECT DISTINCT teams.name, series_post.year FROM teams JOIN series_post ON teams.tmid = series_post.tmidwinner WHERE series_post.round = 'F' AND series_post.year BETWEEN 1950 AND 1960
Database: professional_basketball
Note: team name refers to teams.name; coach refers to coachid; 'Quarter Final' round refers to round = 'QF'; in 1946 refers to year = 1946;
Question: Name the teams along with the coaches that went to 'Quarter Final' round in 1946.
SQL: SELECT DISTINCT coaches.coachid, teams.name FROM coaches JOIN series_post ON coaches.tmid = series_post.tmidwinner JOIN teams ON teams.tmid = coaches.tmid WHERE series_post.round = 'QF' AND series_post.year = 1946
Database: professional_basketball
Note: full name refers to firstname, middlename, lastname; won the championship refers to round = 'F'; in 1970 refers to year = 1970;
Question: List out all the players fullname who won the championship in 1970.
SQL: SELECT DISTINCT players.firstname, players.middlename, players.lastname FROM series_post INNER JOIN players_teams ON series_post.tmidwinner = players_teams.tmid INNER JOIN players ON players.playerid = players_teams.playerid WHERE series_post.year = 1970 AND series_post.round = 'F'
Database: professional_basketball
Note: college refers to highschool; won the most award refers to max(count(award)); in 1970 refers to year = 1970;
Question: From which college was the player who won the most award in 1970.
SQL: SELECT college FROM players WHERE playerid = ( SELECT playerid FROM awards_players WHERE YEAR = 1970 GROUP BY playerid ORDER BY count(award) DESC LIMIT 1 )
Database: professional_basketball
Note: player name refers to playerid; the youngest refers to max(birthdate); won "Rookie of the year" refers to award = 'Rookie of the year';
Question: Name the youngest player who ever won "Rookie of the Year".
SQL: SELECT players.firstname, players.middlename, players.lastname FROM players INNER JOIN awards_players ON players.playerid = awards_players.playerid WHERE awards_players.award = 'Rookie of the Year' ORDER BY players.birthdate DESC LIMIT 1
Database: professional_basketball
Note: full name refers to firstname, middlename, lastname; in 1973 refers to year = 1973; not born in USA refers to birthcountry <> 'USA';
Question: List the full name of players who are drafted from round 1 in 1973 but not born in USA.
SQL: SELECT players.firstname, players.middlename, players.lastname FROM players INNER JOIN draft ON players.playerid = draft.playerid WHERE draft.draftround = 1 AND players.birthcountry != 'USA' AND draft.draftyear = 1973
Database: professional_basketball
Note: in year 2000 refers to year = 2000; percentage = divide(sum(o_rebounds), sum(rebounds)) * 100%;
Question: What is the percentage of offense rebounds from the total rebounds of the players in year 2000.
SQL: SELECT cast(sum(player_allstar.o_rebounds) AS REAL) * 100 / sum(player_allstar.rebounds) FROM players_teams INNER JOIN player_allstar ON players_teams.playerid = player_allstar.playerid WHERE players_teams.year = 2000
Database: professional_basketball
Note: team refers to teams.name; coach refers to coachid; winning rate of above 75% refers to divide(won, add(won, lost)) > 0.75;
Question: List the year, team and coach that with winning rate of above 75%.
SQL: SELECT DISTINCT coaches.year, teams.name, coaches.coachid FROM coaches INNER JOIN teams ON coaches.tmid = teams.tmid WHERE cast(coaches.won AS REAL) / cast((coaches.won + coaches.lost) AS REAL) > 0.75
Database: professional_basketball
Note: coach refers to coachid; Oklahoma City Thunder refers to name = 'Oklahoma City Thunder';
Question: List all the coatches of the Oklahoma City Thunder
SQL: SELECT DISTINCT coachid FROM coaches INNER JOIN teams ON coaches.tmid = teams.tmid WHERE name = 'Oklahoma City Thunder'
Database: professional_basketball
Note: in 1990 refers to season_id = 1990; 50% or less of orebounds than drebounds refers to o_rebounds <= multiply(d_rebounds, 0.5);
Question: How many players, in games played in 1990, achieved 50% or less of oRebounds than dRebounds.
SQL: SELECT count(playerid) FROM players_teams WHERE cast(orebounds AS REAL) * 100 / drebounds <= 50 AND YEAR = 1990
Database: professional_basketball
Note: did not get more than 10 steals refers to count(steals) <= 10; between the years 2000 and 2005 refers to season_id between 2000 and 2005;
Question: How many players did not get more than 10 steals between the years 2000 and 2005?
SQL: SELECT count(DISTINCT playerid) FROM player_allstar WHERE season_id BETWEEN 2000 AND 2005 AND steals <= 10
Database: professional_basketball
Note: 2nd draftround refers to draftround = 2; won Rookie of the year refers to award = 'Rookie of the year'; in 1971 refers to draftyear = 1971;
Question: Which player selected by Portland in 2nd draftRound won Rookie of the Year in 1971?
SQL: SELECT draft.playerid FROM draft INNER JOIN awards_players ON draft.playerid = awards_players.playerid WHERE awards_players.award = 'Rookie of the Year' AND draft.draftyear = 1971 AND draft.draftround = 2
Database: professional_basketball
Note: 1973 season refers to season_id = 1973; black refers to race = 'B';
Question: How many All Star players who played in the 1973 season were black?
SQL: SELECT count(DISTINCT players.playerid) FROM players INNER JOIN player_allstar ON players.playerid = player_allstar.playerid WHERE player_allstar.season_id = 1973 AND players.race = 'B'
Database: professional_basketball
Note: team refers to tmid; quarterfinal refers to round = 'QF'; score 3,513 defensive points refers to d_pts >= 3513;
Question: Which winning team in the 1947 playoff quarterfinals managed to score 3,513 defensive points that same year?
SQL: SELECT teams.tmid FROM series_post INNER JOIN teams ON series_post.tmidwinner = teams.tmid WHERE series_post.year = 1947 AND series_post.round = 'QF' AND teams.d_pts = 3513
Database: professional_basketball
Note: Houston Mavericks refers to name = 'Houston Mavericks'; percentage = divide(sum(lost), sum(games)) * 100%;
Question: Percentage of games lost out of total games played by the Houston Mavericks
SQL: SELECT cast(sum(lost) AS REAL) * 100 / sum(games) FROM teams WHERE name = 'Houston Mavericks'
Database: professional_basketball
Note: player refers to playerid; "Most Valuable Player" award refers to award = 'Most Valuable Player'; after the year of 1990 refers to year > 1990; id refers to playerid;
Question: Please list the players who received the "Most Valuable Player" award in the NBA league after the year of 1990, along with their IDs.
SQL: SELECT playerid FROM awards_players WHERE YEAR > 1990 AND award = 'Most Valuable Player' AND lgid = 'NBA'
Database: professional_basketball
Note: between 1975 and 1980 refers to year between 1975 and 1980; player abdulka01 refers to playerid = 'abdulka01'; play for lAl refers to tmid = 'lAl';
Question: How many times between 1975 and 1980 did the player abdulka01 play for LAL?
SQL: SELECT count(DISTINCT players_teams.year) FROM players INNER JOIN players_teams ON players.playerid = players_teams.playerid WHERE players_teams.tmid = 'LAL' AND players_teams.year BETWEEN 1975 AND 1980 AND players.playerid = 'abdulka01'
Database: professional_basketball
Note: in 1969 refers to year = 1969; awarded "NBA Coach of the year" refers to award = 'NBA Coach of the year'; percentage = divide(count(coachid where year = 1969 and award = 'NBA Coach of the year'), count(coachid)) * 100%;
Question: What is the percentage of coaches in 1969 who were awarded "NBA Coach of the Year"?
SQL: SELECT cast(sum(CASE WHEN award = 'NBA Coach of the Year' THEN 1 ELSE 0 END) AS REAL) * 100 / count(*) FROM awards_coaches WHERE YEAR = 1969
Database: professional_basketball
Note: CHS team refers to tmidwinner = 'CHS'; difference = subtract(divide(count(series_post where year = 1947 and tmidwinner = 'CHS'), count(series_post where year = 1947)), divide(count(series_post where year = 1946 and tmidwinner = 'CHS'), count(series_post where year = 1946)));
Question: What were the difference of the CHS team's winning rate between 1946 and 1947 in the post-season series games? Please provide your answer in percentages.
SQL: SELECT cast(sum(CASE WHEN YEAR = 1947 AND tmidwinner = 'CHS' THEN 1 ELSE 0 END) AS REAL) * 100 / sum(CASE WHEN YEAR = 1947 THEN 1 ELSE 0 END) - cast(sum(CASE WHEN YEAR = 1946 AND tmidwinner = 'CHS' THEN 1 ELSE 0 END) AS REAL) * 100 / sum(CASE WHEN YEAR = 1946 THEN 1 ELSE 0 END) FROM series_post
Database: professional_basketball
Note: in 2010 refers to year = 2010; attended high school in Chicago refers to college = 'Chicago';
Question: How many awards were given out in 2010 to players who attended high school in Chicago?
SQL: SELECT count(awards_players.award) FROM awards_players INNER JOIN players ON awards_players.playerid = players.playerid WHERE awards_players.year = 2010 AND players.hscity = 'Chicago'
Database: professional_basketball
Note: Auburn University refers to college = 'Auburn'; won an "All-Defensive Second Team" award refers to award = 'All-Defensive Second Team'; percentage = divide(count(playerid where award = 'All-Defensive Second Team'), count(playerid)) where college = 'Auburn' * 100%;
Question: What is the percentage of players who attended Auburn University and won an "All-Defensive Second Team" award?
SQL: SELECT cast(sum(CASE WHEN awards_players.award = 'All-Defensive Second Team' THEN 1 ELSE 0 END) AS REAL) * 100 / count(*) FROM players INNER JOIN awards_players ON players.playerid = awards_players.playerid WHERE players.college = 'Auburn'
Database: professional_basketball
Note: full name refers to firstname, middlename, lastname; in the year 1997 refers to year = 1997; the most steals refers to max(steals);
Question: Please list the top five players with the most steals in the year 1997. Please give their full name.
SQL: SELECT DISTINCT players.firstname, players.middlename, players.lastname FROM players INNER JOIN player_allstar ON players.playerid = player_allstar.playerid WHERE player_allstar.season_id = 1997 ORDER BY player_allstar.steals DESC LIMIT 5
Database: professional_basketball
Note: name of the university refers to highschool; NBA refers to lgid = 'NBA'; Finals MVP refers to award = 'Finals MVP'; in 1990 refers to year = 1990;
Question: What is the name of the university that was drafted from the player who won the NBA Finals MVP in 1990?
SQL: SELECT players.college FROM players INNER JOIN awards_players ON players.playerid = awards_players.playerid WHERE awards_players.year = 1990 AND awards_players.award = 'Finals MVP'
Database: professional_basketball
Note: NBA refers to lgid = 'NBA'; in 1996 season refers to season_id = 1996; more than 70% free throw rate refers to ft_made >= 0 AND ft_attempted > 0 AND divide(ft_made, ft_attempted) > 0.7;
Question: Among the NBA All-star players in 1996 season , which have more than 70% free throw rate? Please give their player id.
SQL: SELECT playerid FROM player_allstar WHERE season_id = 1996 AND cast(ft_made AS REAL) * 100 / ft_attempted > 70
Database: professional_basketball
Note: from 1980 to 1983 refers to year BETwEEN 1980 and 1983; NBA refers to lgid = 'NBA'; more than 60% three point rate refers to divide(threemade, threeattempted) > 0.6;
Question: From 1980 to 1983, how many of the NBA All-Star players have more than 60% three point rate?
SQL: SELECT DISTINCT players_teams.playerid FROM player_allstar INNER JOIN players_teams ON player_allstar.playerid = players_teams.playerid WHERE players_teams.year BETWEEN 1980 AND 1983 AND player_allstar.three_made / player_allstar.three_attempted > 0.6
Database: professional_basketball
Note: NBA refers to lgid = 'NBA'; STl team refers to tmid = 'STl';
Question: Among the NBA winning coaches, which are from STL team? Please list their coach id.
SQL: SELECT DISTINCT awards_coaches.coachid FROM coaches INNER JOIN awards_coaches ON coaches.coachid = awards_coaches.coachid WHERE coaches.tmid = 'STL' AND coaches.lgid = 'NBA'
Database: professional_basketball
Note: CHI refers to tmid = 'CHI'; awarded Coach of the year refers to award = 'Coach of the year'; NBA refers to lgid = 'NBA';
Question: How many times have coaches who were from CHI been awarded as NBA Coach of the Year?
SQL: SELECT count(DISTINCT awards_coaches.coachid) FROM coaches INNER JOIN awards_coaches ON coaches.coachid = awards_coaches.coachid WHERE coaches.tmid = 'CHI' AND awards_coaches.award = 'NBA Coach of the Year'
Database: professional_basketball
Note: NBA refers to lgid = 'NBA'; between 1990 and 2000 refers to year between 1990 and 2000; the most points refers to max(points);
Question: Of the players drafted in NBA between 1990 and 2000, who has the most points in all-star? List the player's first name and last name.
SQL: SELECT draft.firstname, draft.lastname FROM player_allstar INNER JOIN awards_players ON player_allstar.playerid = awards_players.playerid INNER JOIN draft ON player_allstar.playerid = draft.playerid WHERE awards_players.year BETWEEN 1990 AND 2000 ORDER BY player_allstar.points DESC LIMIT 1
Database: professional_basketball
Note: wake Forest college refers to highschool = 'wake Forest college'; did the most offensive rebounds than defensive rebounds refers to max(subtract(sum(orebounds), sum(drebounds))); full name refers to first_name, middle_name, last_name;
Question: Which player from Wake Forest college did the most offensive rebounds than defensive rebounds in the all-star? Please mention the full name of the player including the middle name if have any.
SQL: SELECT players.firstname, players.middlename, players.lastname FROM players INNER JOIN player_allstar ON players.playerid = player_allstar.playerid WHERE players.college = 'Wake Forest' AND player_allstar.o_rebounds > player_allstar.d_rebounds
Database: professional_basketball
Note: full name refers to first_name, middle_name, last_name; born in Atlanta refers to birthcity = 'Atlanta'; the highest number of blocks refers to max(blocks); team refers to tmid;
Question: Find the full name of the player born in Atlanta and have the highest number of blocks. Also, in which team did this player perform the most number of blocks?
SQL: SELECT players.firstname, players.lastname, players_teams.tmid FROM players INNER JOIN players_teams ON players.playerid = players_teams.playerid WHERE players.birthcity = 'Atlanta' ORDER BY players_teams.blocks DESC LIMIT 1
Database: professional_basketball
Note: name of team refers to teams.name; between 1980 and 2000 refers to year between 1980 and 2000; ranked first five or more times refers to count(rank = 1) >= 5; lost a league two or more times refers to lost > 2;
Question: State the name of teams ranked first five or more times and lost a league two or more times between 1980 and 2000?
SQL: SELECT teams.name FROM teams INNER JOIN series_post ON teams.tmid = series_post.tmidloser AND teams.year = series_post.year WHERE teams.rank < 5 AND series_post.lgidloser > 2 AND series_post.year BETWEEN 1980 AND 2000
Database: professional_basketball
Note: team refers to tmid; the highest point per minute refers to max(divide(points, minutes)); NBA refers to lgid = 'NBA'; from 1991 to 2000 refers to year BETwEEN 1991 AND 2000;
Question: Player from which team has the highest point per minute in NBA from 1991 to 2000?
SQL: SELECT tmid FROM players_teams WHERE YEAR BETWEEN 1991 AND 2000 ORDER BY cast(points AS REAL) / minutes DESC LIMIT 1
Database: professional_basketball
Note: ABA refers to lgid = 'ABA'; NBA refers to lgid = 'NBA'; between the years 1970 and 1970 refers to draftyear between 1970 and 1970; difference = subtract(avg(subtract(1970, year(birthdate)) where lgid = 'ABA'), avg(subtract(1970, year(birthdate)) where lgid = 'NBA'));
Question: What is the difference in the average age of players when they are drafted in the ABA vs when they are drafted in the NBA between the years 1970 and 1970?
SQL: SELECT cast(sum(iif(players_teams.lgid = 'ABA', 1970 - strftime('%Y', players.birthdate), 0)) AS REAL) / count(iif(players_teams.lgid = 'ABA', 1, 0)) - cast(sum(iif(players_teams.lgid = 'NBA', 1970 - strftime('%Y', players.birthdate), 0)) AS REAL) / count(iif(players_teams.lgid = 'NBA', 1, 0)) FROM draft INNER JOIN players_teams ON draft.tmid = players_teams.tmid INNER JOIN players ON players_teams.playerid = players.playerid WHERE draft.draftyear BETWEEN 1970 AND 1970
Database: professional_basketball
Note: player refers to playerid; the most game presentations refers to max(gp); in 2020 refers to year = 2020; NBA season refers to lgid = 'NBA';
Question: Which player had the most game presentatons in 2011 NBA season.
SQL: SELECT playerid FROM players_teams WHERE YEAR = 2011 ORDER BY gp DESC LIMIT 1
Database: professional_basketball
Note: first round refers to round = 1; in 1996 refers to year = 1996; NBA refers to lgid = 'NBA';
Question: How many first round draft player in 1996 NBA draft became an All-Star?
SQL: SELECT count(player_allstar.playerid) FROM draft INNER JOIN player_allstar ON draft.playerid = player_allstar.playerid WHERE draft.draftyear = 1996 AND draft.draftround = 1