Chinastark/bird_dataset huggingface dataset:
Database: formula_1
Note: average = AVG(milliseconds);
Question: What is the average lap time in milliseconds of all the lap records set on the various circuits in Italy?
SQL: SELECT cast(sum(laptimes.milliseconds) AS REAL) / count(laptimes.lap) FROM laptimes INNER JOIN races ON laptimes.raceid = races.raceid INNER JOIN circuits ON races.circuitid = circuits.circuitid WHERE circuits.country = 'Italy'
Database: european_football_2
Note: highest overall rating refers to MAX(overall_rating);
Question: Which player has the highest overall rating? Indicate the player's api id.
SQL: SELECT player_api_id FROM player_attributes ORDER BY overall_rating DESC LIMIT 1
Database: european_football_2
Note: tallest player refers to MAX(height);
Question: What is the height of the tallest player? Indicate his name.
SQL: SELECT player_name FROM player ORDER BY height DESC LIMIT 1
Database: european_football_2
Note: preferred foot when attacking refers to preferred_foot; lowest potential refers to MIN(potential);
Question: What is the preferred foot when attacking of the player with the lowest potential?
SQL: SELECT preferred_foot FROM player_attributes WHERE potential IS NOT NULL ORDER BY potential ASC LIMIT 1
Database: european_football_2
Note: overall_rating >= 60 AND overall_rating < 65; players whose going to be in all of your attack moves instead of defensing refers to defensive_work_rate = 'low';
Question: Among the players with an overall rating between 60 to 65, how many players whose going to be in all of your attack moves instead of defensing?
SQL: SELECT count(id) FROM player_attributes WHERE overall_rating BETWEEN 60 AND 65 AND defensive_work_rate = 'low'
Database: european_football_2
Note: perform better in crossing actions refers to MAX(crossing);
Question: Who are the top 5 players who perform better in crossing actions? Indicate their player id.
SQL: SELECT id FROM player_attributes ORDER BY crossing DESC LIMIT 5
Database: european_football_2
Note: league that had the most goals refers to MAX(SUM(home_team_goal, away_team_goal)); 2016 season refers to season = '2015/2016';
Question: Give the name of the league had the most goals in the 2016 season?
SQL: SELECT league.name FROM MATCH INNER JOIN league ON MATCH.league_id = league.id WHERE MATCH.season = '2015/2016' GROUP BY league.name ORDER BY sum(MATCH.home_team_goal + MATCH.away_team_goal) DESC LIMIT 1
Database: european_football_2
Note: home team lost the matches refers to SUBTRACT(home_team_goal, away_team_goal) < 0; 2016 season refers to season = '2015/2016';
Question: Which home team had lost the fewest matches in the 2016 season?
SQL: SELECT teamdetails.team_long_name FROM MATCH AS matchdata INNER JOIN team AS teamdetails ON matchdata.home_team_api_id = teamdetails.team_api_id WHERE matchdata.season = '2015/2016' AND matchdata.home_team_goal - matchdata.away_team_goal < 0 GROUP BY matchdata.home_team_api_id ORDER BY count(*) ASC LIMIT 1
Database: european_football_2
Note: full name refers to player_name; players with highest number of penalties refers to MAX(penalties);
Question: Indicate the full names of the top 10 players with the highest number of penalties.
SQL: SELECT player.player_name FROM player_attributes INNER JOIN player ON player_attributes.id = player.id ORDER BY player_attributes.penalties DESC LIMIT 10
Database: european_football_2
Note: Final result should return the team.team_long_name; Scotland Premier league refers to league.name = 'Scotland Premier league'; away team refers to away_team_api_id; away team that won the most refers to MAX(SUBTRACT(away_team_goal, home_team_goal) > 0); 2010 season refers to season = '2009/2010'; won the most refers to MAX(COUNT(*));
Question: In Scotland Premier League, which away team won the most during the 2010 season?
SQL: SELECT teaminfo.team_long_name FROM league AS leaguedata INNER JOIN MATCH AS matchdata ON leaguedata.id = matchdata.league_id INNER JOIN team AS teaminfo ON matchdata.away_team_api_id = teaminfo.team_api_id WHERE leaguedata.name = 'Scotland Premier League' AND matchdata.season = '2009/2010' AND matchdata.away_team_goal - matchdata.home_team_goal > 0 GROUP BY matchdata.away_team_api_id ORDER BY count(*) DESC LIMIT 1
Database: european_football_2
Note: speed in which attacks are put together refers to buildupplayspeed;highest build up play speed refers to MAX(buildupplayspeed);
Question: What are the speed in which attacks are put together of the top 4 teams with the highest build Up Play Speed?
SQL: SELECT team_attributes.buildupplayspeed FROM team_attributes INNER JOIN team ON team_attributes.team_api_id = team.team_api_id ORDER BY team_attributes.buildupplayspeed ASC LIMIT 4
Database: european_football_2
Note: most matches end as draw refers to MAX(SUM(home_team_goal = away_team_goal)); 2016 season refers to season = '2015/2016';
Question: Give the name of the league had the most matches end as draw in the 2016 season?
SQL: SELECT league.name FROM MATCH INNER JOIN league ON MATCH.league_id = league.id WHERE MATCH.season = '2015/2016' AND MATCH.home_team_goal = MATCH.away_team_goal GROUP BY league.name ORDER BY count(MATCH.id) DESC LIMIT 1
Database: european_football_2
Note: players age at present = SUBTRACT((dateTIME(), birthday)); sprint speed of no less than 97 refers to sprint_speed >= 97; between 2013 to 2015 refers to YEAR(date) >= '2013' AND YEAR(date) <= '2015';
Question: At present, calculate for the player's age who have a sprint speed of no less than 97 between 2013 to 2015.
SQL: SELECT DISTINCT datetime() - player.birthday age FROM player_attributes INNER JOIN player ON player_attributes.player_api_id = player.player_api_id WHERE strftime('%Y',player_attributes.`date`) >= '2013' AND strftime('%Y',player_attributes.`date`) <= '2015' AND player_attributes.sprint_speed >= 97
Database: european_football_2
Note: league with highest matches of all time refers to MAX(COUNT(league_id));
Question: Give the name of the league with the highest matches of all time and how many matches were played in the said league.
SQL: SELECT league.name, t1.max_count FROM league JOIN (SELECT league_id, max(cnt) AS max_count FROM (SELECT league_id, count(id) AS cnt FROM MATCH GROUP BY league_id) AS subquery) AS t1 ON t1.league_id = league.id
Database: european_football_2
Note: average height = DIVidE(SUM(height), COUNT(id)); players born between 1990 and 1995 refers to birthday >= '1990-01-01 00:00:00' AND birthday < '1996-01-01 00:00:00';
Question: What is the average height of players born between 1990 and 1995?
SQL: SELECT sum(height) / count(id) FROM player WHERE substr(birthday, 1, 4) BETWEEN '1990' AND '1995'
Database: european_football_2
Note: highest above average overall ratings refers to MAX(overall_rating); in 2010 refers to substr(date,1,4) = '2010';
Question: List the players' api id who had the highest above average overall ratings in 2010.
SQL: SELECT player_api_id FROM player_attributes WHERE substr(`date`, 1, 4) = '2010' ORDER BY overall_rating DESC LIMIT 1
Database: european_football_2
Note: teams with more than 50 but less than 60 build-up play speed refers to buildupplayspeed >50 AND buildupplayspeed <60;
Question: Give the team_fifa_api_id of teams with more than 50 but less than 60 build-up play speed.
SQL: SELECT DISTINCT team_fifa_api_id FROM team_attributes WHERE buildupplayspeed > 50 AND buildupplayspeed < 60
Database: european_football_2
Note: long name of teams refers to team_long_name; build-up play passing refers to buildupplaypassing; above-average build-up play passing = buildupplaypassing > DIVidE(SUM(buildupplaypassing), COUNT(team_long_name) WHERE buildupplaypassing IS NOT NULL); in 2012 refers to strftime('%Y', date) = '2012';
Question: List the long name of teams with above-average build-up play passing in 2012.
SQL: SELECT DISTINCT team.team_long_name FROM team_attributes INNER JOIN team ON team_attributes.team_api_id = team.team_api_id WHERE substr(team_attributes.`date`, 1, 4) = '2012' AND team_attributes.buildupplaypassing > ( SELECT cast(sum(team_attributes.buildupplaypassing) AS REAL) / count(team.id) FROM team INNER JOIN team_attributes ON team.team_api_id = team_attributes.team_api_id WHERE strftime('%Y',team_attributes.`date`) = '2012')
Database: european_football_2
Note: players who prefer left foot refers to preferred_foot = 'left'; percentage of players who prefer left foot = DIVidE(MULTIPLY((SUM(preferred_foot = 'left'), 100)), COUNT(player_fifa_api_id)); born between 1987 and 1992 refers to YEAR(birthday) BETWEEN '1987' AND '1992';
Question: Calculate the percentage of players who prefer left foot, who were born between 1987 and 1992.
SQL: SELECT cast(count(CASE WHEN player_attributes.preferred_foot = 'left' THEN player.id ELSE NULL END) AS REAL) * 100 / count(player.id) percent FROM player INNER JOIN player_attributes ON player.player_api_id = player_attributes.player_api_id WHERE substr(player.birthday, 1, 4) BETWEEN '1987' AND '1992'
Database: european_football_2
Note: number of goals made in all seasons combine = SUM(home_team_goal, away_team_goal);
Question: List the top 5 leagues in ascending order of the number of goals made in all seasons combined.
SQL: SELECT league.name, sum(MATCH.home_team_goal) + sum(MATCH.away_team_goal) FROM league INNER JOIN MATCH ON league.id = MATCH.league_id GROUP BY league.name ORDER BY sum(MATCH.home_team_goal) + sum(MATCH.away_team_goal) ASC LIMIT 5
Database: european_football_2
Note: average number of long shot = DIVidE(SUM(long_shots), COUNT(player_fifa_api_id));
Question: Find the average number of long-shot done by Ahmed Samir Farag.
SQL: SELECT cast(sum(player_attributes.long_shots) AS REAL) / count(player_attributes.`date`) FROM player INNER JOIN player_attributes ON player.player_api_id = player_attributes.player_api_id WHERE player.player_name = 'Ahmed Samir Farag'
Database: european_football_2
Note: heights are above 180 refers to player.height > 180; average heading accuracy = DIVidE(SUM(heading_accuracy), COUNT(player_fifa_api_id));
Question: List the top 10 players' names whose heights are above 180 in descending order of average heading accuracy.
SQL: SELECT player.player_name FROM player INNER JOIN player_attributes ON player.player_api_id = player_attributes.player_api_id WHERE player.height > 180 GROUP BY player.id ORDER BY cast(sum(player_attributes.heading_accuracy) AS REAL) / count(player_attributes.`player_fifa_api_id`) DESC LIMIT 10
Database: european_football_2
Note: normal build-up play dribbling class refers to buildupplaydribblingclass = 'Normal'; in 2014 refers to date >= '2014-01-01 00:00:00' AND date <= '2014-01-31 00:00:00'; names of the teams refers to team_long_name; less than average chance creation passing = DIVidE(SUM(chancecreationpassing), COUNT(id)) > chancecreationpassing;
Question: For the teams with normal build-up play dribbling class in 2014, List the names of the teams with less than average chance creation passing, in descending order of chance creation passing.
SQL: SELECT team.team_long_name FROM team INNER JOIN team_attributes ON team.team_api_id = team_attributes.team_api_id WHERE team_attributes.buildupplaydribblingclass = 'Normal' AND team_attributes.chancecreationpassing < ( SELECT cast(sum(team_attributes.chancecreationpassing) AS REAL) / count(team.id) FROM team INNER JOIN team_attributes ON team.team_api_id = team_attributes.team_api_id WHERE team_attributes.buildupplaydribblingclass = 'Normal' AND substr(team_attributes.`date`, 1, 4) = '2014') ORDER BY team_attributes.chancecreationpassing DESC
Database: european_football_2
Note: name of league refers to league.name; average goals by the home team is higher than the away team = AVG(home_team_goal) > AVG(away_team_goal); AVG(xx_goal) = SUM(xx_goal) / COUNT(DISTINCT match.id); 2009/2010 season refers to season = '2009/2010';
Question: List the name of leagues in which the average goals by the home team is higher than the away team in the 2009/2010 season.
SQL: SELECT league.name FROM league INNER JOIN MATCH ON league.id = MATCH.league_id WHERE MATCH.season = '2009/2010' GROUP BY league.name HAVING (cast(sum(MATCH.home_team_goal) AS REAL) / count(DISTINCT MATCH.id)) - (cast(sum(MATCH.away_team_goal) AS REAL) / count(DISTINCT MATCH.id)) > 0
Database: european_football_2
Note: short name of the football team refers to team_short_name; Queens Park Rangers refers to team_long_name = 'Queens Park Rangers';
Question: What is the short name of the football team Queens Park Rangers?
SQL: SELECT team_short_name FROM team WHERE team_long_name = 'Queens Park Rangers'
Database: european_football_2
Note: players with a birthyear of 1970 and a birthmonth of October refers to substr(birthday,1,7) AS 'year-month',WHERE year = '1970' AND month = '10';
Question: List the football players with a birthyear of 1970 and a birthmonth of October.
SQL: SELECT player_name FROM player WHERE substr(birthday, 1, 7) = '1970-10'
Database: european_football_2
Question: What is the attacking work rate of the football playerr Franco Zennaro?
SQL: SELECT DISTINCT player_attributes.attacking_work_rate FROM player INNER JOIN player_attributes ON player.player_api_id = player_attributes.player_api_id WHERE player.player_name = 'Franco Zennaro'
Database: european_football_2
Note: ADO Den Haag refers to team_long_name = 'ADO Den Haag'; freedom of movement in the 1st two thirds of the pitch refers to buildupplaypositioningclass;
Question: What is the ADO Den Haag team freedom of movement in the 1st two thirds of the pitch?
SQL: SELECT DISTINCT team_attributes.buildupplaypositioningclass FROM team INNER JOIN team_attributes ON team.team_fifa_api_id = team_attributes.team_fifa_api_id WHERE team.team_long_name = 'ADO Den Haag'
Database: european_football_2
Note: header's finishing rate refers to heading_accuracy; on 18/09/2014 refers to date = '2014-09-18 00:00:00';
Question: What is the football player Francois Affolter header's finishing rate on 18/09/2014?
SQL: SELECT player_attributes.heading_accuracy FROM player INNER JOIN player_attributes ON player.player_api_id = player_attributes.player_api_id WHERE player.player_name = 'Francois Affolter' AND substr(player_attributes.`date`, 1, 10) = '2014-09-18'
Database: european_football_2
Note: in year 2011 refers to strftime('%Y', date) = '2011';
Question: What is the overall rating of the football player Gabriel Tamas in year 2011?
SQL: SELECT player_attributes.overall_rating FROM player INNER JOIN player_attributes ON player.player_api_id = player_attributes.player_api_id WHERE player.player_name = 'Gabriel Tamas' AND strftime('%Y', player_attributes.date) = '2011'
Database: european_football_2
Note: Scotland Premier league refers to league.name = 'Scotland Premier league';
Question: How many matches in the 2015/2016 season were held in Scotland Premier League ?
SQL: SELECT count(MATCH.id) FROM league INNER JOIN MATCH ON league.id = MATCH.league_id WHERE MATCH.season = '2015/2016' AND league.name = 'Scotland Premier League'
Database: european_football_2
Note: preferred foot when attacking refers to preferred_foot; youngest football player refers to latest birthday;
Question: What is the preferred foot when attacking of the youngest football player?
SQL: SELECT player_attributes.preferred_foot FROM player INNER JOIN player_attributes ON player.player_api_id = player_attributes.player_api_id ORDER BY player.birthday DESC LIMIT 1
Database: european_football_2
Note: potential score refers to potential; highest potential score refers to MAX(potential);
Question: List all the football player with the highest potential score.
SQL: SELECT distinct(player.player_name) FROM player INNER JOIN player_attributes ON player.player_api_id = player_attributes.player_api_id WHERE player_attributes.potential = (SELECT max(potential) FROM player_attributes)
Database: european_football_2
Note: weight < 130; preferred foot in attacking refers to preferred_foot; preferred_foot = 'left';
Question: Among all the players whose weight is under 130, how many of them preferred foot in attacking is left?
SQL: SELECT count(DISTINCT player.id) FROM player INNER JOIN player_attributes ON player.player_api_id = player_attributes.player_api_id WHERE player.weight < 130 AND player_attributes.preferred_foot = 'left'
Database: european_football_2
Note: chance creation passing class refers to chancecreationpassingclass; chancecreationpassingclass = 'Risky'; short name refers to team_short_name;
Question: List the football teams that has a chance creation passing class of Risky. Inidcate its short name only.
SQL: SELECT DISTINCT team.team_short_name FROM team INNER JOIN team_attributes ON team.team_api_id = team_attributes.team_api_id WHERE team_attributes.chancecreationpassingclass = 'Risky'
Database: european_football_2
Question: What is the defensive work rate of the football player David Wilson ?
SQL: SELECT DISTINCT player_attributes.defensive_work_rate FROM player INNER JOIN player_attributes ON player.player_api_id = player_attributes.player_api_id WHERE player.player_name = 'David Wilson'
Database: european_football_2
Note: football player who has the highest overall rating refers to MAX(overall_rating);
Question: When is the birthday of the football player who has the highest overall rating?
SQL: SELECT player.birthday FROM player INNER JOIN player_attributes ON player.player_api_id = player_attributes.player_api_id ORDER BY player_attributes.overall_rating DESC LIMIT 1
Database: european_football_2
Note: name of the football league refers to league.name;
Question: What is the name of the football league in the country of Netherlands?
SQL: SELECT league.name FROM country INNER JOIN league ON country.id = league.country_id WHERE country.name = 'Netherlands'
Database: european_football_2
Note: average home team goal = AVG(home_team_goal)= SUM(home_team_goal) / COUNT(DISTINCT match.id) WHERE name = 'Poland' and season = '2010/2011';
Question: Calculate the average home team goal in the 2010/2011 season in the country of Poland.
SQL: SELECT cast(sum(MATCH.home_team_goal) AS REAL) / count(MATCH.id) FROM country INNER JOIN MATCH ON country.id = MATCH.country_id WHERE country.name = 'Poland' AND MATCH.season = '2010/2011'
Database: european_football_2
Note: finishing rate refers to finishing; highest average finishing rate = MAX(AVG(finishing)); highest football player refers to MAX(height); shortest football player refers to MIN(height);
Question: Who has the highest average finishing rate between the highest and shortest football player?
SQL: SELECT a FROM ( SELECT avg(finishing) RESULT, 'Max' a FROM player INNER JOIN player_attributes ON player.player_api_id = player_attributes.player_api_id WHERE player.height = ( SELECT max(height) FROM player ) UNION SELECT avg(finishing) RESULT, 'Min' a FROM player INNER JOIN player_attributes ON player.player_api_id = player_attributes.player_api_id WHERE player.height = ( SELECT min(height) FROM player ) ) ORDER BY RESULT DESC LIMIT 1
Database: european_football_2
Note: height>180;
Question: Please list player names which are higher than 180.
SQL: SELECT player_name FROM player WHERE height > 180
Database: european_football_2
Note: born after 1990 refers to strftime('%Y', birthday) = '1990';
Question: How many players were born after 1990?
SQL: SELECT count(id) FROM player WHERE strftime('%Y', birthday) > '1990'
Database: european_football_2
Note: team names refers to team_long_name; speed class refers to buildupplayspeedclass; buildupplayspeedclass = 'Fast';
Question: How many players whose first names are Adam and weigh more than 170?
SQL: SELECT count(id) FROM player WHERE weight > 170 AND player_name LIKE 'Adam%'
Database: european_football_2
Note: overall_rating > 80; from 2008 to 2010 refers to strftime('%Y', date) BETWEEN '2008' AND '2010';
Question: Which players had an overall rating of over 80 from 2008 to 2010? Please list player names.
SQL: SELECT DISTINCT player.player_name FROM player INNER JOIN player_attributes ON player.player_api_id = player_attributes.player_api_id WHERE player_attributes.overall_rating > 80 AND substr(player_attributes.`date`, 1, 4) BETWEEN '2008' AND '2010'
Database: european_football_2
Note: potential score refers to potential;
Question: What is Aaron Doran's potential score?
SQL: SELECT player_attributes.potential FROM player INNER JOIN player_attributes ON player.player_api_id = player_attributes.player_api_id WHERE player.player_name = 'Aaron Doran'
Database: european_football_2
Note: preferred_foot = 'left';
Question: List out of players whose preferred foot is left.
SQL: SELECT DISTINCT player.id, player.player_name FROM player INNER JOIN player_attributes ON player.player_api_id = player_attributes.player_api_id WHERE player_attributes.preferred_foot = 'left'
Database: european_football_2
Note: team names refers to team_long_name; speed class refers to buildupplayspeedclass; buildupplayspeedclass = 'Fast';
Question: Please list all team names which the speed class is fast.
SQL: SELECT DISTINCT team.team_long_name FROM team INNER JOIN team_attributes ON team.team_api_id = team_attributes.team_api_id WHERE team_attributes.buildupplayspeedclass = 'Fast'
Database: european_football_2
Note: passing class refers to buildupplaypassingclass; CLB refers to team_short_name = 'CLB';
Question: What is the passing class of CLB team?
SQL: SELECT DISTINCT team_attributes.buildupplaypassingclass FROM team INNER JOIN team_attributes ON team.team_api_id = team_attributes.team_api_id WHERE team.team_short_name = 'CLB'
Database: european_football_2
Note: build up play passing refers to buildupplaypassing; buildupplaypassing > 70; short names refers to team_short_name;
Question: Which teams have build up play passing more than 70? Please list their short names.
SQL: SELECT DISTINCT team.team_short_name FROM team INNER JOIN team_attributes ON team.team_api_id = team_attributes.team_api_id WHERE team_attributes.buildupplaypassing > 70
Database: european_football_2
Note: from 2010 to 2015 refers to strftime('%Y', date) >= '2010' AND <= '2015'; average overall rating = SUM(t2.overall_rating)/ COUNT(t2.id); higher than 170 refers to player.height > 170;
Question: From 2010 to 2015, what was the average overall rating of players who are higher than 170?
SQL: SELECT cast(sum(player_attributes.overall_rating) AS REAL) / count(player_attributes.id) FROM player INNER JOIN player_attributes ON player.player_api_id = player_attributes.player_api_id WHERE player.height > 170 AND strftime('%Y',player_attributes.`date`) >= '2010' AND strftime('%Y',player_attributes.`date`) <= '2015'
Database: european_football_2
Note: shortest height refers to MIN(height);
Question: Which football player has the shortest height?
SQL: SELECT player_name FROM player ORDER BY height ASC LIMIT 1
Database: european_football_2
Note: Italy Serie A from refers to league.name = 'Italy Serie A';
Question: Which country is the league Italy Serie A from?
SQL: SELECT country.name FROM country INNER JOIN league ON country.id = league.country_id WHERE league.name = 'Italy Serie A'
Database: european_football_2
Note: build up play speed refers to buildupplayspeed; buildupplayspeed = 31; build up play dribbling refers to buildupplaydribbling; buildupplaydribbling = 53; build up play passing refers to buildupplaypassing; buildupplaypassing = 32; short name of the team refers to team_short_name;
Question: List the football team that has a build up play speed of 31, build up plan dribbling of 53, and build up play passing of 32. Only indicate the short name of the team.
SQL: SELECT DISTINCT team.team_short_name FROM team INNER JOIN team_attributes ON team.team_api_id = team_attributes.team_api_id WHERE team_attributes.buildupplayspeed = 31 AND team_attributes.buildupplaydribbling = 53 AND team_attributes.buildupplaypassing = 32
Database: european_football_2
Note: average overall rating = AVG(overall_rating);
Question: What is the average overall rating of the football player Aaron Doran?
SQL: SELECT cast(sum(player_attributes.overall_rating) AS REAL) / count(player_attributes.id) FROM player INNER JOIN player_attributes ON player.player_api_id = player_attributes.player_api_id WHERE player.player_name = 'Aaron Doran'