Chinastark/bird_dataset huggingface dataset:
Database: professional_basketball
Note: "Brooklyn" is the birthcity of player; known by the name of Superman refers to namenick like '%Superman%'; total minutes refers to Sum(minutes);
Question: How many total minutes has the Brooklyn-born player, known by the name of Superman, played during all of his NBA All-Star seasons?
SQL: SELECT sum(player_allstar.minutes) FROM players INNER JOIN player_allstar ON players.playerid = player_allstar.playerid WHERE players.birthcity = 'Brooklyn' AND players.namenick LIKE '%Superman%'
Database: professional_basketball
Note: of 1994 refers to year = 1994; 'NBA Coach of the year' is the award; lost the most time at home refers to Max(homelost);
Question: Of all the teams coached by the winner of the 1994 NBA Coach of the Year award, which team has lost the most times playing at home?
SQL: SELECT teams.tmid FROM awards_coaches INNER JOIN coaches ON awards_coaches.coachid = coaches.coachid INNER JOIN teams ON teams.tmid = coaches.tmid WHERE awards_coaches.year = 1994 AND awards_coaches.award = 'NBA Coach of the Year' GROUP BY teams.tmid ORDER BY sum(teams.homelost) DESC LIMIT 1
Database: professional_basketball
Note: final round of post season refers to round = 'CSF'; won against lAl refers to tmidloser = 'lAl'; in the NBA league refers to lgid = 'NBA'; won more than 60 games refers to won > 60;
Question: Which winning team in the final round of the postseason series games against the LAL won more than 60 games in the NBA league during the year 1996?
SQL: SELECT DISTINCT teams.tmid FROM series_post INNER JOIN teams ON series_post.tmidwinner = teams.tmid WHERE teams.won > 60 AND series_post.year = 1996 AND series_post.round = 'CSF' AND series_post.tmidloser = 'LAL'
Database: professional_basketball
Note: weigh 40% less than the heaviest player refers to weight = Multiply(Max (weight), 0.6); league refers to lgid;
Question: In which league did the player who weighs 40% less than the heaviest player and whose height is 80 inches play?
SQL: SELECT players_teams.lgid FROM players INNER JOIN players_teams ON players.playerid = players_teams.playerid GROUP BY players_teams.lgid, players.weight HAVING players.weight = max(players.weight) - max(players.weight) * 0.4
Database: professional_basketball
Note: "NBA" is the lgid; server more than 2 teams refers to Count(tmid) = 2;
Question: Please list the name of the coach who has served more than 2 NBA teams.
SQL: SELECT coachid FROM coaches GROUP BY coachid HAVING count(DISTINCT tmid) > 2
Database: professional_basketball
Note: the most number of game won in post season refers to Max(post_wins); coach refers to coachid;
Question: What is the name of the coach during whose period of coaching, a team has the most numbers of games won in the post-season games?
SQL: SELECT coachid FROM coaches ORDER BY post_wins DESC LIMIT 1
Database: professional_basketball
Note: served more than 2 NBA teams refers to count (tmid) >= 2; least number of game lost in post season refers to Min(post_losses);
Question: Among the coaches who have served more than 2 NBA teams, during which coach's period of coaching, a team has the least numbers of games lost in the post-season games?
SQL: SELECT coachid FROM coaches WHERE lgid = 'NBA' AND post_wins != 0 AND post_losses != 0 AND coachid IN ( SELECT coachid FROM coaches WHERE lgid = 'NBA' GROUP BY coachid HAVING count(tmid) > 2 ) ORDER BY post_losses ASC LIMIT 1
Database: professional_basketball
Note: "ABA" is the lgid; center position refers to pos =   'C' or pos = 'F-C'; players refers to playerid;
Question: Among the players from the ABA league, how many of them have the center position?
SQL: SELECT count(DISTINCT players.playerid) FROM players INNER JOIN players_teams ON players.playerid = players_teams.playerid WHERE players_teams.lgid = 'ABA' AND (players.pos = 'C' OR players.pos = 'F-C')
Database: professional_basketball
Note: "NBA" is the lgid; with the forward position refers to pos = 'F' of pos = 'F-C';
Question: Please list the first name of the players from the NBA league with the forward position.
SQL: SELECT DISTINCT players.firstname FROM players INNER JOIN players_teams ON players.playerid = players_teams.playerid WHERE (players.pos = 'F' OR players.pos = 'F-C') AND players_teams.lgid = 'NBA'
Database: professional_basketball
Note: high school in Chicago refers to hscity = 'Chicago'; belong to the west conference refers to divid = 'wE';
Question: Among the players who went to high school in Chicago, how many of them belongs to the west conference?
SQL: SELECT count(DISTINCT players.playerid) FROM players INNER JOIN player_allstar ON players.playerid = player_allstar.playerid WHERE players.hscity = 'Chicago' AND player_allstar.conference = 'West'
Database: professional_basketball
Note: belong to the east conference refers to divid = 'EA';
Question: For the players who belongs to the east conference, please list the name of the college they went to.
SQL: SELECT DISTINCT players.college FROM players INNER JOIN player_allstar ON players.playerid = player_allstar.playerid WHERE player_allstar.conference = 'East'
Database: professional_basketball
Note: "NBl" is the lgid; 'Spencer' is the birthcity;
Question: Among the players from the NBL league, how many of them were born in Spencer?
SQL: SELECT count(DISTINCT players.playerid) FROM players INNER JOIN players_teams ON players.playerid = players_teams.playerid WHERE players.birthcity = 'Spencer' AND players_teams.lgid = 'NBL'
Database: professional_basketball
Note: won the most MVP refers to Max(Count(award = 'Most Valuable Player'));
Question: Please list the birth date of the player who has won the most MVPs.
SQL: SELECT players.birthdate FROM players INNER JOIN awards_players ON players.playerid = awards_players.playerid WHERE awards_players.award = 'Most Valuable Player' GROUP BY players.playerid, players.birthdate ORDER BY count(award) DESC LIMIT 1
Database: professional_basketball
Note: "whitestone" is the birthcity of the player; won the MVP refers to award = 'Most Valuable Player';
Question: Among the players born in Whitestone, how many of them have won the MVP?
SQL: SELECT count(DISTINCT players.playerid) FROM players INNER JOIN awards_players ON players.playerid = awards_players.playerid WHERE awards_players.award = 'Most Valuable Player' AND players.birthcity = 'Houston'
Database: professional_basketball
Note: "Rookie of the year" is the award; tallest player refers to Max(height);
Question: Among the players who have won the award of Rookie of the year, what is the height of the tallest player?
SQL: SELECT players.height FROM players INNER JOIN awards_players ON players.playerid = awards_players.playerid WHERE awards_players.award = 'Rookie of the Year' ORDER BY players.height DESC LIMIT 1
Database: professional_basketball
Note: "Rookie of the year" is the award; average weight = divide (Sum(weight), Count(playerid));
Question: What is the average weight of the players who have won the award of Rookie of the year?
SQL: SELECT avg(players.weight) FROM players INNER JOIN awards_players ON players.playerid = awards_players.playerid WHERE awards_players.award = 'Rookie of the Year'
Database: professional_basketball
Note: high school in New York refers to highschool like '%New York%'; won the MVP refers to award = 'Most Valuable Player'; average height = divide (Sum(height), Count(playerid));
Question: Among the players that went to high school in New York and have won the MVP, what is their average height?
SQL: SELECT avg(players.height) FROM players INNER JOIN awards_players ON players.playerid = awards_players.playerid WHERE awards_players.award = 'Most Valuable Player' AND players.birthcity = 'New York'
Database: professional_basketball
Note: in 2000 refers to year = 2000; team with highest score refers to Max(o_fgm);
Question: Please list the top ten teams with the highest scores in 2000.
SQL: SELECT tmid FROM players_teams WHERE YEAR = 2000 GROUP BY tmid ORDER BY sum(postpoints) DESC LIMIT 10
Database: professional_basketball
Note: team with winning rate less than 50% refers to divide (won, Sum(won, lost)) < 0.5;
Question: Which teams have winning rate less than 50%?
SQL: SELECT name FROM teams WHERE cast(won AS REAL) * 100 / (won + lost) < 50
Database: professional_basketball
Note: winning rate of 80% and above refers to divide (won, Sum(won, lost)) > 0.8; coaches refers to coachid;
Question: Who are the coaches for team with winning rate of 80% and above?
SQL: SELECT coachid FROM coaches GROUP BY tmid, coachid, won, lost HAVING cast(won AS REAL) * 100 / (won + lost) > 80
Database: professional_basketball
Note: "NBA" is the lgid; coach who serviced for more than 10 years refers to coachid where Subtract (Max(year), Min(year)) > 10;
Question: Which coach has serviced in NBA for more than 10 years.
SQL: SELECT coachid FROM coaches WHERE lgid = 'NBA' GROUP BY coachid HAVING max(YEAR) - min(YEAR) > 10
Database: professional_basketball
Note: played more than 3800 points refers to Sum(points) >= 3800;
Question: How many teams have played more than 3800 points and have player with "Most Valuable Player" award?
SQL: SELECT count(DISTINCT t4.name) FROM ( SELECT teams.name, sum(players_teams.points) FROM teams INNER JOIN players_teams ON teams.tmid = players_teams.tmid AND teams.year = players_teams.year INNER JOIN awards_players ON players_teams.playerid = awards_players.playerid WHERE awards_players.award = 'Most Valuable Player' GROUP BY teams.name HAVING sum(players_teams.points) >= 3800 ) AS t4
Database: professional_basketball
Note: "AFS" is the tmid; tallest height refers to Max(height);
Question: Which player from "AFS" team has the tallest height?
SQL: SELECT players.firstname, players.middlename, players.lastname FROM players INNER JOIN players_teams ON players.playerid = players_teams.playerid WHERE players_teams.tmid = 'AFS' ORDER BY players.height DESC LIMIT 1
Database: professional_basketball
Note: "BlB" is the tmid;
Question: Please list down the last name of players from "BLB" team.
SQL: SELECT players.lastname FROM players INNER JOIN players_teams ON players.playerid = players_teams.playerid WHERE players_teams.tmid = 'BLB'
Database: professional_basketball
Note: from 1960 to 1975 refers to year between 1960 and 1975;
Question: From 1962 to 1975, how many coaches received the award?
SQL: SELECT count(DISTINCT coachid) FROM awards_coaches WHERE YEAR BETWEEN 1962 AND 1975
Database: professional_basketball
Note: from 1970 to 1990 refers to year between 1970 and 1990;  received award twice refers to coachid where Count(coachid) = 2;
Question: Please list the coach IDs who received the award twice from 1970 to 1990.
SQL: SELECT coachid FROM awards_coaches WHERE YEAR BETWEEN 1970 AND 1990 GROUP BY coachid, award HAVING count(award) = 2
Database: professional_basketball
Note: from 1962 to 2011 refers to year between 1960 and 2011; received both NBA and ABA award refers to coachid where award lIKE 'NBA%' and 'ABA%';
Question: From 1962 to 2011, how many coaches received both NBA and ABA awards?
SQL: SELECT count(DISTINCT coachid) FROM awards_coaches WHERE YEAR BETWEEN 1962 AND 2011 AND award = 'ABA Coach of the Year' AND coachid IN ( SELECT coachid FROM awards_coaches WHERE YEAR BETWEEN 1962 AND 2011 AND award = 'NBA Coach of the Year' )
Database: professional_basketball
Note: in 1975 refers to season_id = 1975; coming from USA refers to birthcountry = 'USA'; average point refers to divide (Sum(points), Count(playerid));
Question: In 1975, what was the average point of all-star players coming from the USA?
SQL: SELECT avg(player_allstar.points) FROM players INNER JOIN player_allstar ON players.playerid = player_allstar.playerid WHERE player_allstar.season_id = 1975
Database: professional_basketball
Note: higher than 75 inch refers to height > 75;
Question: Please list the last names and first names of all-star players who are higher than 75 inch.
SQL: SELECT DISTINCT players.lastname, players.firstname FROM players INNER JOIN player_allstar ON players.playerid = player_allstar.playerid WHERE players.height > 75
Database: professional_basketball
Note: minimum weight refers to Min(weight);
Question: What is the minimum weight of all-star players coming from UCLA college?
SQL: SELECT min(players.weight) FROM players INNER JOIN player_allstar ON players.playerid = player_allstar.playerid WHERE players.college = 'UCLA'
Database: professional_basketball
Note: "USA" is the birthcountry of player;  maximum weight refers to Max(weight);
Question: What is the maximum weight of USA all-star players?
SQL: SELECT max(players.weight) FROM players INNER JOIN player_allstar ON players.playerid = player_allstar.playerid WHERE players.birthcountry = 'USA'
Database: professional_basketball
Note: from 1960 to 1970 refers to season_id between 1960 and 1970; still alive refers to deathdate = '0000-00-00';
Question: From 1960 to 1970, what is the total point of all-star players who are still alive?
SQL: SELECT sum(player_allstar.points) FROM players INNER JOIN player_allstar ON players.playerid = player_allstar.playerid WHERE player_allstar.season_id BETWEEN 1960 AND 1970 AND players.deathdate = '0000-00-00'
Database: professional_basketball
Note: born after 1950 refers to birthdate >= '1950-01-01'; offence rebound rate more than 30% refers to divide (orebounds, rebounds) > 0.3;
Question: Among players who were born after 1950, who had offence rebounds rates more than 30%? Please list their last names and first names.
SQL: SELECT DISTINCT players.lastname, players.firstname FROM players INNER JOIN player_allstar ON players.playerid = player_allstar.playerid WHERE players.birthdate > 1950 AND cast(player_allstar.o_rebounds AS REAL) * 100 / player_allstar.rebounds > 30
Database: professional_basketball
Note: from 1969 to 2010 refers to year BETwEEN 1969 and 2010; 'Rookie of the year' is the award;
Question: How many players received Rookie of the Year award from 1969 to 2010?
SQL: SELECT count(playerid) FROM awards_players WHERE YEAR BETWEEN 1969 AND 2010 AND award = 'Rookie of the Year'
Database: professional_basketball
Note: team with at least 3 all star player refers to tmid where Count(player_allstar.playerid) >= 3;
Question: Please list the team names which have at least 3 all-star players.
SQL: SELECT players_teams.tmid FROM players_teams INNER JOIN player_allstar ON players_teams.playerid = player_allstar.playerid GROUP BY players_teams.tmid HAVING count(DISTINCT players_teams.playerid) >= 3
Database: professional_basketball
Note: from 1950 to 1970 refers to year between 1950 and 1970; team with rank 1 refers to rank = 1; maximum point refers to Max(points);
Question: From 1950 to 1970, what is the maximum point of players whose teams were ranked 1?
SQL: SELECT max(players_teams.points) FROM teams INNER JOIN players_teams ON teams.tmid = players_teams.tmid AND teams.year = players_teams.year WHERE teams.year BETWEEN 1950 AND 1970 AND teams.rank = 1
Database: professional_basketball
Note: from 1937 to 1940 refers to year between 1937 and 1940; rank 1 for 3 years refers to tmid where Count (rank = 1) >= 3;
Question: Please list the last names and first names of all-star players whose team were ranked 1 for consecutive 3 years from 1937 to 1940.
SQL: SELECT players.lastname, players.firstname FROM players_teams INNER JOIN players ON players_teams.playerid = players.playerid WHERE players_teams.year BETWEEN 1937 AND 1940 AND players_teams.tmid IN ( SELECT DISTINCT teams.tmid FROM teams INNER JOIN teams INNER JOIN teams ON teams.tmid = teams.tmid AND teams.tmid = teams.tmid AND teams.year - teams.year = 1 AND teams.year - teams.year = 1 WHERE teams.rank = 1 AND teams.year BETWEEN 1937 AND 1940 )
Database: professional_basketball
Note: from 1937 to 1940 refers to year between 1937 and 1940; player with highest point refers to Max(points);
Question: Among the teams that were ranked 3 from 1937 to 1940, what is the team name whose players had the highest point?
SQL: SELECT DISTINCT teams.name FROM teams INNER JOIN players_teams ON teams.tmid = players_teams.tmid AND teams.year = players_teams.year WHERE teams.rank = 3 AND teams.year BETWEEN 1937 AND 1940 ORDER BY players_teams.points DESC LIMIT 1
Database: professional_basketball
Note: in 1937 refers to year = 1937; player got at least 500 points refers to Sum(points) >= 500;
Question: In 1937, how many teams whose players got at least 500 points?
SQL: SELECT count(*) FROM ( SELECT teams.name, sum(players_teams.points) FROM players_teams INNER JOIN teams ON players_teams.tmid = teams.tmid AND players_teams.year = teams.year WHERE players_teams.year = 1937 GROUP BY teams.name HAVING sum(points) >= 500 ) AS t3
Database: professional_basketball
Note: in 1990 refers to year = 1990; winning rate of more than 75% refers to divide(won, games) > 0.75;
Question: In 1990, how many players whose teams had the winning rate of more than 75%?
SQL: SELECT count(DISTINCT players_teams.playerid) FROM players_teams INNER JOIN teams ON players_teams.tmid = teams.tmid AND players_teams.year = teams.year WHERE cast(teams.won AS REAL) * 100 / cast(teams.games AS REAL) > 75 AND players_teams.year = 1990
Database: professional_basketball
Note: shortest player refers to Min(height); black players refers to race = 'B';
Question: Please list the top three shortest black players.
SQL: SELECT firstname, lastname FROM players WHERE race = 'B' AND height > 0 ORDER BY height ASC LIMIT 3
Database: professional_basketball
Note: drafted in 1970 refers to draftyear = 1970;
Question: How many players with the first name Joe were drafted in 1970?
SQL: SELECT count(DISTINCT playerid) FROM draft WHERE firstname = 'Joe' AND draftyear = 1970
Database: professional_basketball
Note: between 1951 and 1953 refers to season_id; field goal refers to fg_made;
Question: How many field goals did George Mikan make overall between 1951 and 1953?
SQL: SELECT count(fg_made) FROM player_allstar WHERE first_name = 'George' AND last_name = 'Mikan' AND season_id BETWEEN 1951 AND 1953
Database: professional_basketball
Note: BMI = Multiply(divide(weight, Multiply(height, height)), 703);
Question: What are the basketball players' BMI ranges?
SQL: SELECT min(cast(weight AS REAL) / (height * height)) , max(cast(weight AS REAL) / (height * height)) FROM players
Database: professional_basketball
Note: highest home lost rate = Max(divide(homelost, Sum(homewon, homelost)));
Question: What is the name of the team with the highest home lost rate?
SQL: SELECT name FROM teams ORDER BY cast(homewon AS REAL) / (homewon + homelost) DESC LIMIT 1
Database: professional_basketball
Note: age when drafted refers to Subtract(draftyear, year(birthdate)); first drafted refers to draftyear;
Question: How old was Alexis Ajinca when he was first drafted?
SQL: SELECT draftyear - strftime('%Y', birthdate) FROM draft INNER JOIN players ON draft.playerid = players.playerid WHERE draft.firstname = 'Alexis' AND draft.lastname = 'Ajinca' AND draftround = 1
Database: professional_basketball
Note: "Denver Nuggets" is the name of team; since 1980 refers to year > 1980; tallest player = Max(height);
Question: Who is the tallest player in Denver Nuggets since 1980?
SQL: SELECT players.firstname, players.lastname FROM players INNER JOIN players_teams ON players.playerid = players_teams.playerid INNER JOIN teams ON teams.tmid = players_teams.tmid WHERE teams.name = 'Denver Nuggets' AND players_teams.year > 1980 ORDER BY players.height DESC LIMIT 1
Database: professional_basketball
Note: pass away refers to deathdate ! = 'null'; most award refers to playerid where Max(Count(award));
Question: Among the players who have passed away, who had the most award?
SQL: SELECT players.playerid FROM players INNER JOIN awards_players ON players.playerid = awards_players.playerid WHERE deathdate IS NOT NULL GROUP BY players.playerid ORDER BY count(award) DESC LIMIT 1
Database: professional_basketball
Note: "UClA" is the college; team with most players refers to tmid where Max(Count(playerid));
Question: What is the full name of the team that has the most players from UCLA?
SQL: SELECT teams.name FROM players INNER JOIN players_teams ON players.playerid = players_teams.playerid INNER JOIN teams ON teams.tmid = players_teams.tmid WHERE players.college = 'UCLA' GROUP BY teams.name ORDER BY count(DISTINCT players.playerid) DESC LIMIT 1
Database: professional_basketball
Note: average BMI refers to AVG (Multiply(divide(weight, Multiply(height, height)), 703));
Question: What is the average BMI of an All-star player?
SQL: SELECT avg(cast(players.weight AS REAL) / (players.height * players.height)) FROM players INNER JOIN player_allstar ON players.playerid = player_allstar.playerid
Database: professional_basketball
Note: "ABA" is the lgid; from 1972 to 1973 refers to year = 1972 and year = 1973; team with the fastest growth in winning rate = Max(Subtract(divide(won where year = 1973, Sum(won, lost)),divide(won where year = 1972, Sum(won, lost))));
Question: What is the full name of the team with the fastest growth in winning rate in the 'ABA' league from 1972 to 1973?
SQL: SELECT teams.name FROM teams INNER JOIN ( SELECT * FROM teams WHERE lgid = 'ABA' AND YEAR = 1972 ) AS t2 ON teams.tmid = t2.tmid WHERE teams.lgid = 'ABA' AND teams.year = 1973 ORDER BY (cast(teams.won AS REAL) / (teams.won + teams.lost) - (cast(t2.won AS REAL) / (t2.won + t2.lost))) DESC LIMIT 1
Database: professional_basketball
Note: "NBl" is the lgid; most  personal foul refers to Max(Count(pf));
Question: Please list the first names of the players with the most personal fouls in the 'NBL' league.
SQL: SELECT players.firstname FROM players INNER JOIN players_teams ON players.playerid = players_teams.playerid WHERE players_teams.lgid = 'NBL' GROUP BY players.playerid, players.firstname ORDER BY count(pf) DESC LIMIT 1
Database: professional_basketball
Note: average height refers to avg(height);
Question: What is the average height of an East conference All-star player?
SQL: SELECT avg(DISTINCT height) FROM players INNER JOIN player_allstar ON players.playerid = player_allstar.playerid WHERE conference = 'East'
Database: professional_basketball
Note: "ABA Coach of the year" is the award; highest number of won games refers to Max(Count(won));
Question: Among the coaches who won the 'ABA Coach of the Year' award, which is the coach with the highest number of won games?
SQL: SELECT coaches.coachid FROM coaches INNER JOIN awards_coaches ON coaches.coachid = awards_coaches.coachid WHERE awards_coaches.award = 'ABA Coach of the Year' GROUP BY coaches.coachid, coaches.won ORDER BY coaches.won DESC LIMIT 1
Database: professional_basketball
Note: "NBA Coach of the year" is the award; in 1992 refers to year = 1992;
Question: What is the full name of the team that the 'NBA Coach of the Year' 1992 winner coached?
SQL: SELECT name FROM teams INNER JOIN coaches ON teams.tmid = coaches.tmid AND teams.year = coaches.year INNER JOIN awards_coaches ON coaches.coachid = awards_coaches.coachid AND coaches.year = awards_coaches.year WHERE awards_coaches.year = 1992 AND award = 'NBA Coach of the Year'
Database: professional_basketball
Note: in 1973 refers to year = 1973; player with highest field goal made refers to Max(divide(fgmade, fgattempted));
Question: What is the first and last name of the player with the highest field goal made rate in 1973?
SQL: SELECT players.firstname, players.lastname FROM players INNER JOIN players_teams ON players.playerid = players_teams.playerid WHERE YEAR = 1973 ORDER BY cast(players_teams.fgmade AS REAL) / players_teams.fgattempted DESC LIMIT 1
Database: professional_basketball
Note: full name refers to teams.name;
Question: What is the full name of the team that selected Mike Lynn?
SQL: SELECT teams.name FROM teams INNER JOIN draft ON teams.tmid = draft.tmid AND teams.year = draft.draftyear WHERE draft.firstname = 'Mike' AND draft.lastname = 'Lynn'