Chinastark/bird_dataset huggingface dataset:
Database: professional_basketball
Note: team refers to tmid; MVP refers to award like '%MVP'; 1997 refers to year = 1997; NBA refers to lgid = 'NBA';
Question: Which team did the MVP of 1997 NBA season play in?
SQL: SELECT DISTINCT teams.tmid FROM players_teams INNER JOIN awards_players ON players_teams.playerid = awards_players.playerid INNER JOIN teams ON players_teams.tmid = teams.tmid AND players_teams.year = teams.year WHERE awards_players.year = 1997 AND awards_players.award = 'Finals MVP' LIMIT 1
Database: professional_basketball
Note: the scoring champion refers to max(won); 2001 refers to year = 2001; NBA refers to lgid = 'NBA';
Question: How many games did team of the scoring champion win in 2001 NBA season?
SQL: SELECT series_post.w FROM teams INNER JOIN series_post ON teams.tmid = series_post.tmidloser AND teams.year = series_post.year WHERE series_post.year = 2001 ORDER BY teams.o_fgm DESC LIMIT 1
Database: professional_basketball
Note: turnovers per game = avg(turnovers); 2003 refers to year = 2003; NBA refers to lgid = 'NBA';
Question: How many turnovers per game did the assist champion had in the 2003 NBA season?
SQL: SELECT avg(players_teams.turnovers) FROM players INNER JOIN players_teams ON players.playerid = players_teams.playerid WHERE players_teams.year = 2003 GROUP BY players.playerid, players_teams.assists ORDER BY players_teams.assists DESC LIMIT 1
Database: professional_basketball
Note: NBA refers to lgid = 'NBA';
Question: What is the number of NBA titles that Ray Allen has won throughout his NBA career?
SQL: SELECT count(player_allstar.playerid) FROM player_allstar INNER JOIN awards_players ON player_allstar.playerid = awards_players.playerid WHERE first_name = 'Ray' AND last_name = 'Allen'
Database: professional_basketball
Note: No.1 draft pick refers to draftround = 1; in the 2003 season refers to draftyear = 2003; increase = subtract(divide(sum(won), add(sum(won), sum(lost))) where draftyear = 2004, divide(sum(won), add(sum(won), sum(lost))) where draftyear = 2003);
Question: How much did the win rate increase for the team after getting the No.1 NBA draft pick in the 2003 season than previous season?
SQL: SELECT (cast(sum(CASE WHEN teams.year = 2004 THEN teams.won ELSE 0 END) AS REAL) / sum(CASE WHEN teams.year = 2004 THEN teams.won + teams.lost ELSE 0 END)) - (cast(sum(CASE WHEN teams.year = 2003 THEN teams.won ELSE 0 END) AS REAL) / sum(CASE WHEN teams.year = 2003 THEN teams.won + teams.lost ELSE 0 END)) FROM teams INNER JOIN draft ON teams.tmid = draft.tmid WHERE draft.draftround = 1 AND draft.draftyear = 2003
Database: professional_basketball
Note: the 'NBA coach of the year' award refers to award = 'NBA coach of the year'; from 1971 - 1975 refers to year between 1971 and 1975; 'POR' team refers to tmid = 'POR';
Question: Among the coaches who won the 'NBA coach of the year' award from 1971 - 1975, how many of them were in 'POR' team?
SQL: SELECT count(awards_coaches.id) FROM awards_coaches INNER JOIN teams ON awards_coaches.year = teams.year WHERE awards_coaches.year BETWEEN 1971 AND 1975 AND awards_coaches.award = 'NBA Coach of the Year' AND teams.tmid = 'POR'
Database: professional_basketball
Note: NBA refers to lgid = 'NBA'; 'lAl' team refers to tmid = 'lAl'; performed steals movement refers to steals > 0; percent = divide(count(playerid where steals > 0), count(playerid)) where lgid = 'NBA' and tmid = 'lAl' * 100%;
Question: How many percent of points were scored by NBA players who belonged to 'LAL' team and had performed steals movement.
SQL: SELECT cast(sum(iif(players_teams.steals IS NOT NULL AND teams.tmid = 'LAL', 1, 0)) AS REAL) * 100 / count(teams.tmid) FROM teams INNER JOIN players_teams ON teams.tmid = players_teams.tmid AND teams.year = players_teams.year
Database: professional_basketball
Note: name of the player refers to first_name, middle_name, last_name; in 1996 refers to year = 1996; the most steals refers to max(steals); didn't play in the playoffs refers to playoff = null;
Question: What's the name of the player in 1996 who had the most steals that didn't play in the playoffs?
SQL: SELECT players.playerid FROM players INNER JOIN players_teams ON players.playerid = players_teams.playerid WHERE players_teams.year = 1996 AND players_teams.postgp = 0 ORDER BY players_teams.steals DESC LIMIT 1
Database: professional_basketball
Note: the most turnovers refers to max(turnovers); missed the playoffs refers to postgp = 0; in year 1988 refers to year = 1988;
Question: Give the player id of the man who had the most turnovers whose team missed the playoffs in year 1988.
SQL: SELECT players.playerid FROM players_teams INNER JOIN players ON players_teams.playerid = players.playerid WHERE players_teams.postgp = 0 AND players_teams.year = 1988 ORDER BY players_teams.turnovers DESC LIMIT 1
Database: professional_basketball
Note: NBA refers to lgid = 'NBA'; didn't play in the playoffs refers to postgp = 0; 2000 refers to year = 2000; the most winning rate refers to max(divide(won, add(won, lost)));
Question: Which NBA team that didn't play in playoffs had the most winning rate in the 2000 NBA regular season?
SQL: SELECT teams.tmid FROM players_teams INNER JOIN teams ON players_teams.tmid = teams.tmid AND players_teams.year = teams.year WHERE players_teams.postgp = 0 AND players_teams.year = 2000 ORDER BY cast(teams.won AS REAL) / (teams.won + teams.lost) DESC LIMIT 1
Database: professional_basketball
Note: non-playoff refers to postgp = 0; in the year 1998 refers to year = 1998; the most points refers to max(o_pts);
Question: Which non-playoffs team had the most points in the regular season in the year 1998?
SQL: SELECT teams.tmid FROM players_teams INNER JOIN teams ON players_teams.tmid = teams.tmid AND players_teams.year = teams.year WHERE players_teams.year = 1998 AND players_teams.postgp = 0 ORDER BY players_teams.points DESC LIMIT 1
Database: professional_basketball
Note: full name of the team refers to teams.name; in 2001 refers to year = 2001; didn't make the playoffs refers to postgp = 0; won the most games refers to max(won);
Question: What's the full name of the team that won the most games in 2001 but didn't make the playoffs?
SQL: SELECT teams.tmid FROM players_teams INNER JOIN teams ON players_teams.tmid = teams.tmid AND players_teams.year = teams.year WHERE players_teams.postgp = 0 ORDER BY teams.won DESC LIMIT 1
Database: professional_basketball
Note: didn't play in playoffs refers to postgp = 0; in the year 1997 refers to year = 1997; the most total rebounds refers to max(o_tmRebound);
Question: Which team that didn't play in playoffs had the most total rebounds in the year 1997?
SQL: SELECT teams.tmid FROM players_teams INNER JOIN teams ON players_teams.tmid = teams.tmid AND players_teams.year = teams.year WHERE players_teams.postgp = 0 AND players_teams.year = 1997 ORDER BY players_teams.rebounds DESC LIMIT 1
Database: professional_basketball
Note: drafted in the 1st round refers to draftround = 1; 6th position refers to draftselection = 6; in 1976 refers to year = 1976; team refers to tmid;
Question: For the player who was drafted in the 1st round, 6th position in 1976, which team did he play in that year?
SQL: SELECT teams.tmid FROM draft INNER JOIN teams ON draft.tmid = teams.tmid AND draft.draftyear = teams.year WHERE draft.draftround = 1 AND draft.draftselection = 6 AND draft.draftyear = 1976
Database: professional_basketball
Note: in 1998 refers to year = 1998; 1st round refers to draftround = 1; 12th pick refers to draftselection = 12; home win refers to homewon;
Question: In the year 1998, how many home wins did the team which had the 1st round, 12th pick have that year?
SQL: SELECT teams.homewon FROM draft INNER JOIN teams ON draft.tmid = teams.tmid AND draft.draftyear = teams.year WHERE draft.draftround = 1 AND draft.draftselection = 12 AND draft.draftyear = 1998
Database: professional_basketball
Note: the most rebounds refers to max(rebounds);
Question: For the player who had the most rebounds throughout his allstar appearances, what was his weight and height?
SQL: SELECT players.weight, players.height FROM players INNER JOIN player_allstar ON players.playerid = player_allstar.playerid ORDER BY player_allstar.rebounds DESC LIMIT 1
Database: professional_basketball
Note: the most rebounds refers to max(rebounds);
Question: Where was the high school of the player who had the most rebounds in the NBA allstar history?
SQL: SELECT players.highschool FROM player_allstar INNER JOIN players ON player_allstar.playerid = players.playerid ORDER BY player_allstar.rebounds DESC LIMIT 1
Database: professional_basketball
Note: in 1997 refers to year = 1997; the most rebounds refers to max(rebounds); team id refers to tmid;
Question: In the year 1997 allstar game, which teams did the players had the most rebounds play in? List their team ids.
SQL: SELECT teams.tmid FROM players_teams INNER JOIN teams ON players_teams.tmid = teams.tmid AND players_teams.year = teams.year INNER JOIN player_allstar ON player_allstar.playerid = players_teams.playerid WHERE player_allstar.season_id = 1997 ORDER BY players_teams.rebounds DESC LIMIT 1
Database: professional_basketball
Note: the latest passing refers to max(season_id); play all the positions refers to pos like '%C%' or pos like '%F%' or pos like '%G%';
Question: For the latest passing player who could play all the positions in the court, how many points did he have in his career?
SQL: SELECT sum(players_teams.points) FROM players INNER JOIN players_teams ON players.playerid = players_teams.playerid WHERE players.pos = 'C-F-G' GROUP BY players_teams.playerid, players_teams.year ORDER BY players_teams.year DESC LIMIT 1
Database: professional_basketball
Note: team refers to tmid; the youngest refers to max(year); F-G position refers to pos like '%F'; NBA refers to lgid = 'NBA';
Question: Which team did the youngest player who could be in F-G position play in the NBA?
SQL: SELECT teams.tmid FROM teams INNER JOIN players_teams ON teams.tmid = players_teams.tmid AND teams.year = players_teams.year INNER JOIN players ON players_teams.playerid = players.playerid WHERE players.pos = 'F-G' AND players_teams.lgid = 'NBA' ORDER BY players.birthdate DESC LIMIT 1
Database: professional_basketball
Note: the most PBlA games refers to max(games_played); Central Missouri State college refers to college = 'Central Missouri State';
Question: For the players who played the most PBLA games, who was graduated from Central Missouri State college?
SQL: SELECT players.firstname, players.middlename, players.lastname FROM players INNER JOIN players_teams ON players.playerid = players_teams.playerid WHERE players_teams.lgid = 'PBLA' AND players_teams.gp = 10 AND players.college = 'Central Missouri State' GROUP BY players.firstname, players.middlename, players.lastname ORDER BY count(players_teams.id) DESC LIMIT 1
Database: professional_basketball
Note: in 2000 refers to year = 2000; played the least minutes refers to min(minutes); without missing a single game refers to gp = 82; full name of the team refers to teams.name;
Question: In 2000, which team did the player who played the least minutes without missing a single game play in? Give the full name of the team.
SQL: SELECT teams.tmid FROM teams INNER JOIN players_teams ON teams.tmid = players_teams.tmid AND teams.year = players_teams.year WHERE players_teams.gp = 82 AND players_teams.year = 2000 GROUP BY teams.tmid ORDER BY sum(players_teams.postminutes) ASC LIMIT 1
Database: professional_basketball
Note: full attendance refers to gp = 82; in 1995 refers to year = 1995; the most turnovers refers to max(turnovers); full name refers to first_name, last_name;
Question: For all the full attendence players in 1995, which player had most turnovers? Give the full name of the player.
SQL: SELECT players.firstname, players.middlename, players.lastname FROM players INNER JOIN players_teams ON players.playerid = players_teams.playerid WHERE players_teams.gp = 82 AND players_teams.year = 1995 ORDER BY players_teams.turnovers DESC LIMIT 1
Database: professional_basketball
Note: in 2011 refers to year = 2011; started every game refers to gp = gs; the most steals refers to max(steals); team refers to tmid;
Question: For the player in 2011 who started every game he played, which team had the player who had the most steals?
SQL: SELECT teams.tmid FROM teams INNER JOIN players_teams ON teams.tmid = players_teams.tmid AND teams.year = players_teams.year WHERE teams.year = 2011 AND players_teams.gp = players_teams.gs GROUP BY teams.tmid, players_teams.steals ORDER BY players_teams.steals DESC LIMIT 1
Database: professional_basketball
Note: the same starting player refers to gp = gs; full name of the team refers to teams.name;
Question: Which team had the most same starting players througout the season? Give the full name of the team.
SQL: SELECT DISTINCT teams.tmid FROM teams INNER JOIN players_teams ON teams.tmid = players_teams.tmid AND teams.year = players_teams.year WHERE players_teams.gp = players_teams.gs
Database: professional_basketball
Note: 2001 refers to year = 2001; rebounds leader refers to max(rebounds); birthday refers to birthdate;
Question: For the 2001 rebounds leader in the league, when was his birthday?
SQL: SELECT birthdate FROM players WHERE playerid = ( SELECT playerid FROM players_teams WHERE YEAR = 2001 GROUP BY playerid ORDER BY sum(rebounds + drebounds) DESC LIMIT 1 )
Database: professional_basketball
Note: rebound champion refers to max(rebounds); 1997 refers to 1997; full name refers to teams.name;
Question: Which team did the all league rebound champion play in 1997? Give the full name of the team.
SQL: SELECT teams.name FROM teams INNER JOIN players_teams ON teams.tmid = players_teams.tmid AND teams.year = players_teams.year WHERE players_teams.year = 1997 GROUP BY teams.name ORDER BY sum(rebounds + drebounds) DESC LIMIT 1
Database: professional_basketball
Note: more than one player refers to count(playerid) > 1; grabbed more than 600 rebounds refers to rebounds > 600; in 2011 refers to 2011; full name refers to teams.name;
Question: Which team had more than one player who grabbed more than 600 rebounds in 2011? Give the full name of the team.
SQL: SELECT teams.tmid FROM teams INNER JOIN players_teams ON teams.tmid = players_teams.tmid AND teams.year = players_teams.year WHERE teams.year = 2011 AND players_teams.rebounds > 600
Database: shakespeare
Note: finished before the year 1602 refers to date < 1602;
Question: How many of Shakespeare's works were finished before the year 1602?
SQL: SELECT count(id) FROM works WHERE Date < 1602
Database: shakespeare
Note: Twelfth Night refers to title = 'Twelfth Night';
Question: How many scenes are there in Act 1 in Twelfth Night?
SQL: SELECT count(works.id) FROM works INNER JOIN chapters ON works.id = chapters.work_id WHERE chapters.act = 1 AND works.title = 'Twelfth Night'
Database: shakespeare
Note: Twelfth Night refers to title = 'Twelfth Night';
Question: What is the description of Act 1, Scene 2 in Twelfth Night?
SQL: SELECT chapters.description FROM works INNER JOIN chapters ON works.id = chapters.work_id WHERE works.title = 'Twelfth Night' AND chapters.act = 1 AND chapters.scene = 2
Database: shakespeare
Note: in Twelfth Night refers to title = 'Twelfth Night'; How many more scenes = subtract(sum(act = 1), sum(act = 5));
Question: How many more scenes are there in Act 1 than in Act 5 in Twelfth Night?
SQL: SELECT sum(iif(chapters.act = 1, 1, 0)) - sum(iif(chapters.act = 5, 1, 0)) AS MORE FROM works INNER JOIN chapters ON works.id = chapters.work_id WHERE works.title = 'Twelfth Night'
Database: shakespeare
Note: Lord Abergavenny refers to charname = 'Lord Abergavenny'; short or abbreviated title refers to title;
Question: Which work is the character Lord Abergavenny from? Please give its short or abbreviated title.
SQL: SELECT DISTINCT works.title FROM works INNER JOIN chapters ON works.id = chapters.work_id INNER JOIN paragraphs ON chapters.id = paragraphs.chapter_id INNER JOIN characters ON paragraphs.character_id = characters.id WHERE characters.charname = 'Lord Abergavenny'
Database: shakespeare
Note: character names refers to charname; Twelfth Night refers to title = 'Twelfth Night';
Question: Please list the character names of all the characters from the work Twelfth Night.
SQL: SELECT DISTINCT characters.charname FROM works INNER JOIN chapters ON works.id = chapters.work_id INNER JOIN paragraphs ON chapters.id = paragraphs.chapter_id INNER JOIN characters ON paragraphs.character_id = characters.id WHERE works.title = 'Twelfth Night'
Database: shakespeare
Note: Twelfth Night refers to title = 'Twelfth Night';
Question: How many paragraphs are there in Act 1, Scene 1 in Twelfth Night?
SQL: SELECT sum(paragraphs.paragraphnum) FROM works INNER JOIN chapters ON works.id = chapters.work_id INNER JOIN paragraphs ON chapters.id = paragraphs.chapter_id WHERE chapters.act = 1 AND chapters.scene = 1 AND works.title = 'Twelfth Night'
Database: shakespeare
Note: Twelfth Night refers to title = 'Twelfth Night'; list the paragraphs refers to plaintext;
Question: Please list all the paragraphs in Act 1, Scene 1 in Twelfth Night.
SQL: SELECT paragraphs.plaintext FROM works INNER JOIN chapters ON works.id = chapters.work_id INNER JOIN paragraphs ON chapters.id = paragraphs.chapter_id WHERE chapters.act = 1 AND chapters.scene = 1 AND works.title = 'Twelfth Night'
Database: shakespeare
Note: Lord Abergavenny refers to charname = 'Lord Abergavenny';
Question: How many paragraphs contain the character Lord Abergavenny?
SQL: SELECT sum(paragraphs.paragraphnum) FROM paragraphs INNER JOIN characters ON paragraphs.character_id = characters.id WHERE characters.charname = 'Lord Abergavenny'
Database: shakespeare
Note: character "son to Tamora"  refers to characters.description = 'son to Tamora';
Question: Please list the IDs of the paragraphs in which the character "son to Tamora" appears.
SQL: SELECT paragraphs.id FROM paragraphs INNER JOIN characters ON paragraphs.character_id = characters.id WHERE characters.description = 'son to Tamora'
Database: shakespeare
Note: "OLIVIA’S house."  refers to chapters.description = 'OLIVIA’S house.'; Twelfth Night refers to title = 'Twelfth Night';
Question: For how many times has the scene "OLIVIA’S house." appeared in Twelfth Night?
SQL: SELECT count(chapters.id) FROM works INNER JOIN chapters ON works.id = chapters.work_id WHERE chapters.description = 'OLIVIA’S house.' AND works.title = 'Twelfth Night'
Database: shakespeare
Note: Twelfth Night refers to title = 'Twelfth Night';
Question: How many characters are there in Twelfth Night?
SQL: SELECT count(DISTINCT characters.id) FROM works INNER JOIN chapters ON works.id = chapters.work_id INNER JOIN paragraphs ON chapters.id = paragraphs.chapter_id INNER JOIN characters ON paragraphs.character_id = characters.id WHERE works.title = 'Twelfth Night'
Database: shakespeare
Note: most characters refers to max(count(character_id));
Question: Please give the title of the work of Shakespeare that has the most characters.
SQL: SELECT t.title FROM ( SELECT works.title, count(paragraphs.character_id) AS num FROM works works INNER JOIN chapters chapters ON works.id = chapters.work_id INNER JOIN paragraphs paragraphs ON chapters.id = paragraphs.chapter_id INNER JOIN characters characters ON paragraphs.character_id = characters.id GROUP BY paragraphs.character_id, works.title ) t ORDER BY t.num DESC LIMIT 1
Database: shakespeare
Note: average number = divide(sum(character_id), count(work_id));
Question: What is the average number of characters in all the works of Shakespeare?
SQL: SELECT sum(DISTINCT characters.id) / count(works.id) FROM works INNER JOIN chapters ON works.id = chapters.work_id INNER JOIN paragraphs ON chapters.id = paragraphs.chapter_id INNER JOIN characters ON paragraphs.character_id = characters.id
Database: shakespeare
Note: Twelfth Night refers to title = 'Twelfth Night'; average scene = divide(sum(scene), count(act));
Question: How many scenes are there on average in one act in Twelfth Night?
SQL: SELECT sum(chapters.scene) / count(chapters.act) FROM works INNER JOIN chapters ON works.id = chapters.work_id WHERE works.title = 'Twelfth Night'
Database: shakespeare
Note: comedies refers to genretype = 'Comedy';
Question: How many comedies did Shakespeare create?
SQL: SELECT count(id) FROM works WHERE genretype = 'Comedy'
Database: shakespeare
Note: first poem refers to genretype = 'Poem' and date = 'min';
Question: When did Shakespeare write the first poem?
SQL: SELECT min(Date) FROM works WHERE genretype = 'Poem'
Database: shakespeare
Note: abbreviation name refers to abbrev; character "Earl of Westmoreland" refers to charname = 'Earl of Westmoreland';
Question: Give the abbreviation name for the character "Earl of Westmoreland".
SQL: SELECT DISTINCT abbrev FROM characters WHERE charname = 'Earl of Westmoreland'
Database: shakespeare
Note: most paragraphs refers to max(count(chapter_id));
Question: Which chapter has the most paragraphs? Give the description of the chapter.
SQL: SELECT chapters.description FROM chapters INNER JOIN paragraphs ON chapters.id = paragraphs.chapter_id ORDER BY paragraphs.paragraphnum DESC LIMIT 1
Database: shakespeare
Note: paragraph "Would he do so, I'ld beg your precious mistress, Which he counts but a trifle."  refers to plaintext = 'Would he do so, I'ld beg your precious mistress, Which he counts but a trifle.';
Question: Which character was mentioned in the paragraph "Would he do so, I'ld beg your precious mistress, Which he counts but a trifle."? Give the character name.
SQL: SELECT characters.charname FROM characters INNER JOIN paragraphs ON characters.id = paragraphs.character_id WHERE paragraphs.plaintext = 'Would he do so, I''ld beg your precious mistress,Which he counts but a trifle.'
Database: shakespeare
Note: Titus Andronicus refers to title = 'Titus Andronicus';
Question: How many characters are there in Titus Andronicus?
SQL: SELECT count(DISTINCT paragraphs.character_id) FROM works INNER JOIN chapters ON works.id = chapters.work_id INNER JOIN paragraphs ON chapters.id = paragraphs.chapter_id WHERE works.title = 'Titus Andronicus'
Database: shakespeare
Note: Two Gentlemen of Verona refers to longtitle = 'Two Gentlemen of Verona';
Question: List the number of acts in Two Gentlemen of Verona.
SQL: SELECT DISTINCT chapters.act FROM chapters INNER JOIN works ON chapters.id = chapters.work_id WHERE works.longtitle = 'Two Gentlemen of Verona'
Database: shakespeare
Note: paragraph No.640171 refers to paragraphs.id = '640171';
Question: What is the description for the character mentioned in paragraph No.640171?
SQL: SELECT characters.description FROM characters INNER JOIN paragraphs ON characters.id = paragraphs.character_id WHERE paragraphs.id = '640171'
Database: shakespeare
Note: character "Shylock" refers to charname = 'Shylock';
Question: Give the title of the work that contains the character "Shylock".
SQL: SELECT DISTINCT works.title FROM works INNER JOIN chapters ON works.id = chapters.work_id INNER JOIN paragraphs ON chapters.id = paragraphs.chapter_id INNER JOIN characters ON paragraphs.character_id = characters.id WHERE characters.charname = 'Shylock'
Database: shakespeare
Note: King John refers to title = 'King John';
Question: How many scenes are there in King John?
SQL: SELECT count(chapters.scene) FROM works INNER JOIN chapters ON works.id = chapters.work_id WHERE works.title = 'King John'
Database: shakespeare
Note: character Demetrius refers to charname = 'Demetrius';
Question: How many chapters does the character Demetrius show in the story?
SQL: SELECT count(DISTINCT paragraphs.chapter_id) FROM characters INNER JOIN paragraphs ON characters.id = paragraphs.character_id WHERE characters.charname = 'Demetrius'
Database: shakespeare
Question: Which Shakespeare story with character ID 324 has description of 'this friend of Caesar'?
SQL: SELECT works.title FROM works INNER JOIN chapters ON works.id = chapters.work_id INNER JOIN paragraphs ON chapters.id = paragraphs.chapter_id INNER JOIN characters ON paragraphs.character_id = characters.id WHERE chapters.id = '324' AND chapters.description = 'friend to Caesar'