target-benchmark/bird-queries-validation huggingface dataset:
Database: formula_1
Question: How many drivers from the USA participated in the 2008 Australian Grand Prix?
Evidence: from the USA refers to nationality = 'American'
SQL: SELECT COUNT(*) FROM drivers AS T1 INNER JOIN results AS T2 ON T1.driverId = T2.driverId INNER JOIN races AS T3 ON T3.raceId = T2.raceId WHERE T3.name = 'Australian GrAND Prix' AND T1.nationality = 'American' AND T3.year = 2008
Database: formula_1
Question: Among the drivers that finished the race in the 2008 Australian Grand Prix, how many of them have participated in Formula_1 races?
Evidence: COUNT(raceID) > 0 reveals that this driver participated in races; drivers who finished the race refers to time has value.
SQL: SELECT COUNT(*) FROM ( SELECT T1.driverId FROM results AS T1 INNER JOIN races AS T2 on T1.raceId = T2.raceId WHERE T2.name = 'Australian Grand Prix' AND T2.year = 2008 AND T1.time IS NOT NULL GROUP BY T1.driverId HAVING COUNT(T2.raceId) > 0 )
Database: formula_1
Question: What is the rate of drivers completing all the laps in the 2008 Australian Grand Prix?
Evidence: completing all the laps refers to time is not null; rate = divide(COUNT(raceID where time is not null), COUNT(raceID))
SQL: SELECT CAST(SUM(IIF(T1.time IS NOT NULL, 1, 0)) AS REAL) * 100 / COUNT(T1.resultId) FROM results AS T1 INNER JOIN races AS T2 ON T1.raceId = T2.raceId WHERE T2.name = 'Australian GrAND Prix' AND T2.year = 2008
Database: formula_1
Question: How much faster in percentage is the champion than the driver who finished the race last in the 2008 Australian Grand Prix?
Evidence: how much faster in percentage = divide(subtract(incremental time, champion time), last_driver time) * 100%; last driver finished time = incremental time + champion time; only champion's finished time is represented by 'HH:MM:SS.mmm'; finished the game refers to time is not null
SQL: WITH time_in_seconds AS ( SELECT T1.positionOrder, CASE WHEN T1.positionOrder = 1 THEN (CAST(SUBSTR(T1.time, 1, 1) AS REAL) * 3600) + (CAST(SUBSTR(T1.time, 3, 2) AS REAL) * 60) + CAST(SUBSTR(T1.time, 6) AS REAL) ELSE CAST(SUBSTR(T1.time, 2) AS REAL) END AS time_seconds FROM results AS T1 INNER JOIN races AS T2 ON T1.raceId = T2.raceId WHERE T2.name = 'Australian Grand Prix' AND T1.time IS NOT NULL AND T2.year = 2008 ), champion_time AS ( SELECT time_seconds FROM time_in_seconds WHERE positionOrder = 1), last_driver_incremental AS ( SELECT time_seconds FROM time_in_seconds WHERE positionOrder = (SELECT MAX(positionOrder) FROM time_in_seconds) ) SELECT (CAST((SELECT time_seconds FROM last_driver_incremental) AS REAL) * 100) / (SELECT time_seconds + (SELECT time_seconds FROM last_driver_incremental) FROM champion_time)
Database: formula_1
Question: How many circuits are there in Melbourne, Australia?
Evidence: Australia is the country; Melbourne is the location of circuit;
SQL: SELECT COUNT(circuitId) FROM circuits WHERE location = 'Melbourne' AND country = 'Australia'
Database: formula_1
Question: What are the average points of British constructors?
Evidence: average points = AVG(points); British is a nationality
SQL: SELECT AVG(T1.points) FROM constructorStandings AS T1 INNER JOIN constructors AS T2 on T1.constructorId = T2.constructorId WHERE T2.nationality = 'British'
Database: formula_1
Question: Please list the constructor names with 0 points at race 291.
Evidence: race at 18 refers to raceID = 18;
SQL: SELECT T2.name FROM constructorStandings AS T1 INNER JOIN constructors AS T2 on T1.constructorId = T2.constructorId WHERE T1.points = 0 AND T1.raceId = 291
Database: formula_1
Question: How many Japanese constructors have 0 points in 2 races?
Evidence: 2 races refers to COUNT(raceID) = 2;
SQL: SELECT COUNT(T1.raceId) FROM constructorStandings AS T1 INNER JOIN constructors AS T2 on T1.constructorId = T2.constructorId WHERE T1.points = 0 AND T2.nationality = 'Japanese' GROUP BY T1.constructorId HAVING COUNT(raceId) = 2
Database: formula_1
Question: Please calculate the race completion percentage of Japanese drivers from 2007 to 2009.
Evidence: from 2007 to 2009 refers to year between 2007 and 2009; race completion refers to time is not null; percentage = Divide(COUNT(DriverID where time is not null and year between 2007 and 2009),Count (DriverID where year between 2007 and 2009))*100;
SQL: SELECT CAST(SUM(IIF(T1.time IS NOT NULL, 1, 0)) AS REAL) * 100 / COUNT(T1.raceId) FROM results AS T1 INNER JOIN races AS T2 on T1.raceId = T2.raceId INNER JOIN drivers AS T3 on T1.driverId = T3.driverId WHERE T3.nationality = 'Japanese' AND T2.year BETWEEN 2007 AND 2009
Database: formula_1
Question: What is the average time in seconds of champion for each year?
Evidence: only champion's finished time is represented by 'HH:MM:SS.mmm'; finished the game refers to time is not null.
SQL: WITH time_in_seconds AS ( SELECT T2.year, T2.raceId, T1.positionOrder, CASE WHEN T1.positionOrder = 1 THEN (CAST(SUBSTR(T1.time, 1, 1) AS REAL) * 3600) + (CAST(SUBSTR(T1.time, 3, 2) AS REAL) * 60) + CAST(SUBSTR(T1.time, 6) AS REAL) ELSE CAST(SUBSTR(T1.time, 2) AS REAL) END AS time_seconds FROM results AS T1 INNER JOIN races AS T2 ON T1.raceId = T2.raceId WHERE T1.time IS NOT NULL ), champion_time AS ( SELECT year, raceId, time_seconds FROM time_in_seconds WHERE positionOrder = 1 ) SELECT year, AVG(time_seconds) FROM champion_time GROUP BY year HAVING AVG(time_seconds) IS NOT NULL
Database: formula_1
Question: How many French drivers who obtain the laptime less than 02:00.00?
Evidence: lap time less than 01:00.00 refers to seconds < 120;
SQL: SELECT COUNT(T1.driverId) FROM drivers AS T1 INNER JOIN lapTimes AS T2 on T1.driverId = T2.driverId WHERE T1.nationality = 'French' AND (CAST(SUBSTR(T2.time, 1, 2) AS INTEGER) * 60 + CAST(SUBSTR(T2.time, 4, 2) AS INTEGER) + CAST(SUBSTR(T2.time, 7, 2) AS REAL) / 1000) < 120
Database: formula_1
Question: How many Australian drivers who were born in 1980?
Evidence: born in 1980 refers to year(dob) = 1980;
SQL: SELECT COUNT(driverId) FROM drivers WHERE nationality = 'Australian' AND STRFTIME('%Y', dob) = '1980'
Database: formula_1
Question: How many times the circuits were held in Austria? Please give their location and coordinates.
Evidence: location coordinates refers to (lat,lng);
SQL: SELECT DISTINCT location, lat, lng FROM circuits WHERE country = 'Austria'
Database: formula_1
Question: On what year did the youngest driver had his first qualifying race? State the name, date and time of the race.
Evidence: youngest driver refers to Max (year(dob));
SQL: SELECT T3.year, T3.name, T3.date, T3.time FROM qualifying AS T1 INNER JOIN drivers AS T2 on T1.driverId = T2.driverId INNER JOIN races AS T3 on T1.raceId = T3.raceId WHERE T1.driverId = ( SELECT driverId FROM drivers ORDER BY dob DESC LIMIT 1 ) ORDER BY T3.date ASC LIMIT 1
Database: formula_1
Question: How many American drivers have been disqualified from the race.
Evidence: disqualified refers to statusID = 2;
SQL: SELECT COUNT(T1.driverId) FROM drivers AS T1 INNER JOIN results AS T2 on T1.driverId = T2.driverId INNER JOIN status AS T3 on T2.statusId = T3.statusId WHERE T3.status = 2 AND T1.nationality = 'American'
Database: formula_1
Question: What is the average fastest lap time of the top 10 drivers in the 2006 United States Grand Prix?
Evidence: top 10 refers to rank <11; AVG(fastestLapTime);
SQL: SELECT AVG(T1.fastestLapTime) FROM results AS T1 INNER JOIN races AS T2 on T1.raceId = T2.raceId WHERE T1.rank < 11 AND T2.year = 2006 AND T2.name = 'United States GrAND Prix'
Database: formula_1
Question: List down top 5 German drivers who has the shortest average pit stop duration and were born between 1980-1985.
Evidence: born between 1980-1985 refers to 1980< year(dob)>1985; Average pitstop duration refers to Divide(SUM(duration),COUNT(duration)); shortest average refers to Min(avg(duration));
SQL: SELECT T2.forename, T2.surname FROM pitStops AS T1 INNER JOIN drivers AS T2 on T1.driverId = T2.driverId WHERE T2.nationality = 'German' AND STRFTIME('%Y', T2.dob) BETWEEN '1980' AND '1985' GROUP BY T2.forename, T2.surname ORDER BY AVG(T1.duration) LIMIT 5
Database: formula_1
Question: As of the present, what is the full name of the youngest racer? Indicate her nationality and the name of the race to which he/she first joined.
Evidence: full name refers to forename+surname; Youngest racer = MAX(dob)

SQL: SELECT T1.forename, T1.surname, T1.nationality, T3.name FROM drivers AS T1 INNER JOIN driverStandings AS T2 on T1.driverId = T2.driverId INNER JOIN races AS T3 on T2.raceId = T3.raceId ORDER BY JULIANDAY(T1.dob) DESC LIMIT 1
Database: formula_1
Question: How many wins was achieved by the oldest racer? Indicate his/her full name.
Evidence: oldest racer refers to MIN(dob); full name refers to forename, surname.
SQL: SELECT SUM(T1.wins) FROM driverStandings AS T1 INNER JOIN drivers AS T2 on T1.driverId = T2.driverId GROUP BY T2.forename, T2.surname ORDER BY T2.dob ASC LIMIT 1
Database: formula_1
Question: Which driver created the shortest lap time ever record in a Formula_1 race? Please give his full name.
Evidence: shortest lap time refers to MIN(time)
SQL: WITH lap_times_in_seconds AS ( SELECT driverId, (CASE WHEN INSTR(time, ':') <> INSTR(SUBSTR(time, INSTR(time, ':') + 1), ':') + INSTR(time, ':') THEN CAST(SUBSTR(time, 1, INSTR(time, ':') - 1) AS REAL) * 3600 ELSE 0 END) + (CAST(SUBSTR(time, INSTR(time, ':') - 2 * (INSTR(time, ':') = INSTR(SUBSTR(time, INSTR(time, ':') + 1), ':') + INSTR(time, ':')), INSTR(time, ':') - 1) AS REAL) * 60) + (CAST(SUBSTR(time, INSTR(time, ':') + 1, INSTR(time, '.') - INSTR(time, ':') - 1) AS REAL)) + (CAST(SUBSTR(time, INSTR(time, '.') + 1) AS REAL) / 1000) as time_in_seconds FROM lapTimes) SELECT T2.forename, T2.surname FROM ( SELECT driverId, MIN(time_in_seconds) as min_time_in_seconds FROM lap_times_in_seconds GROUP BY driverId) AS T1 INNER JOIN drivers AS T2 on T1.driverId = T2.driverId ORDER BY T1.min_time_in_seconds ASC LIMIT 1
Database: european_football_2
Question: Which league had the most goals in the 2016 season?
Evidence: league that had the most goals refers to MAX(SUM(home_team_goal, away_team_goal)); 2016 season refers to season = '2015/2016';
SQL: SELECT t2.name FROM Match AS t1 INNER JOIN League AS t2 ON t1.league_id = t2.id WHERE t1.season = '2015/2016' GROUP BY t2.name ORDER BY SUM(t1.home_team_goal + t1.away_team_goal) DESC LIMIT 1
Database: european_football_2
Question: In Scotland Premier League, which away team won the most during the 2010 season?
Evidence: 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';
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
Question: What are the speed in which attacks are put together of the top 4 teams with the highest build Up Play Speed?
Evidence: speed in which attacks are put together refers to buildUpPlaySpeed;highest build up play speed refers to MAX(buildUpPlaySpeed)
SQL: SELECT t1.buildUpPlaySpeed FROM Team_Attributes AS t1 INNER JOIN Team AS t2 ON t1.team_api_id = t2.team_api_id ORDER BY t1.buildUpPlayDribbling ASC LIMIT 4
Database: european_football_2
Question: Which League had the most matches end as draw in the 2016 season?
Evidence: most matches end as draw refers to MAX(SUM(home_team_goal = away_team_goal)); 2016 season refers to season = '2015/2016';
SQL: SELECT t2.name FROM Match AS t1 INNER JOIN League AS t2 ON t1.league_id = t2.id WHERE t1.season = '2015/2016' AND t1.home_team_goal = t1.away_team_goal GROUP BY t2.name ORDER BY COUNT(t1.id) DESC LIMIT 1
Database: european_football_2
Question: At present, calculate for the player's age who have a sprint speed of no less than 97 between 2013 to 2015.
Evidence: players age at present = SUBTRACT((DATETIME(), birthday)); sprint_speed > = 97; between 2013 to 2015 refers to date > = '2013-01-01 00:00:00' AND date < = '2015-12-31 00:00:00';
SQL: SELECT DATETIME() - T2.birthday age FROM Player_Attributes AS t1 INNER JOIN Player AS t2 ON t1.player_api_id = t2.player_api_id WHERE SUBSTR(t1.`date`, 1, 10) BETWEEN '2013-01-01' AND '2015-12-31' AND t1.sprint_speed >= 97
Database: european_football_2
Question: Give the name of the league with the highest matches of all time and how many matches were played in the said league.
Evidence: name of the league refers to League.name; league with highest matches of all time refers to MAX(COUNT(league_id));
SQL: SELECT t2.name, COUNT(t1.id) FROM Match AS t1 INNER JOIN League AS t2 ON t1.league_id = t2.id GROUP BY t2.name ORDER BY COUNT(t1.id) DESC LIMIT 1
Database: european_football_2
Question: Give the team_fifa_api_id of teams with more than 50 but less than 60 build-up play speed.
Evidence: teams with more than 50 but less than 60 build-up play speed refers to buildUpPlaySpeed BETWEEN 51 AND 59;
SQL: SELECT DISTINCT team_fifa_api_id FROM Team_Attributes WHERE buildUpPlaySpeed > 50 AND buildUpPlaySpeed < 60
Database: european_football_2
Question: List the long name of teams with above-average build-up play passing in 2012.
Evidence: long name of teams refers to team_long_name; build-up play passing refers to buildUpPlayPassing; above-average build-up play passing = DIVIDE(SUM(buildUpPlayPassing), COUNT(team_long_name) WHERE buildUpPlayPassing IS NOT NULL) < buildUpPlayPassing; in 2012 refers to strftime('%Y', date) = '2012';
SQL: SELECT DISTINCT t4.team_long_name FROM Team_Attributes AS t3 INNER JOIN Team AS t4 ON t3.team_api_id = t4.team_api_id WHERE SUBSTR(t3.`date`, 1, 4) = '2012' AND t3.buildUpPlayPassing > ( SELECT CAST(SUM(t2.buildUpPlayPassing) AS REAL) / COUNT(t1.id) FROM Team AS t1 INNER JOIN Team_Attributes AS t2 ON t1.team_api_id = t2.team_api_id WHERE SUBSTR(t2.`date`, 1, 4) = '2012' )
Database: european_football_2
Question: Calculate the percentage of players who prefer left foot, who were born between 1987 and 1992.
Evidence: players who prefer left foot refers to preferred_foot = 'left'; percentage of players who prefer left foot = DIVIDE(MULTIPLY((SUM(preferred_foot = 'left'), 1.0)), COUNT(player_fifa_api_id)); born between 1987 and 1992 refers to birthday BETWEEN '1987-01-01 00:00:00'AND '1992-12-31 00:00:00';
SQL: SELECT CAST(COUNT(CASE WHEN t2.preferred_foot = 'left' THEN t1.id ELSE NULL END) AS REAL) * 100 / COUNT(t1.id) percent FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id WHERE SUBSTR(t1.birthday, 1, 4) BETWEEN '1987' AND '1992'
Database: european_football_2
Question: List the top 10 players' names whose heights are above 180 in descending order of average heading accuracy.
Evidence: height > 180; average heading accuracy = DIVIDE(SUM(heading_accuracy), COUNT(player_fifa_api_id));
SQL: SELECT t1.player_name FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id WHERE t1.height > 180 GROUP BY t1.id ORDER BY CAST(SUM(t2.heading_accuracy) AS REAL) / COUNT(t2.`player_fifa_api_id`) DESC LIMIT 10
Database: european_football_2
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.
Evidence: 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);
SQL: SELECT t1.name FROM League AS t1 INNER JOIN Match AS t2 ON t1.id = t2.league_id WHERE t2.season = '2009/2010' GROUP BY t1.name HAVING (CAST(SUM(t2.home_team_goal) AS REAL) / COUNT(DISTINCT t2.id)) - (CAST(SUM(t2.away_team_goal) AS REAL) / COUNT(DISTINCT t2.id)) > 0
Database: european_football_2
Question: List the football players with a birthyear of 1970 and a birthmonth of October.
Evidence: players with a birthyear of 1970 and a birthmonth of October refers to substr(birthday,1,4) AS year, substr(birthday,6,2) AS month WHERE year = '1970' AND month = '10';
SQL: SELECT player_name FROM Player WHERE SUBSTR(birthday, 1, 7) = '1970-10'
Database: european_football_2
Question: What is the overall rating of the football player Gabriel Tamas in year 2011?
Evidence: in year 2011 refers to strftime('%Y', date) = '2011';
SQL: SELECT t2.overall_rating FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id WHERE t1.player_name = 'Gabriel Tamas' AND SUBSTR(t2.`date`, 1, 4) = '2011'
Database: european_football_2
Question: Calculate the average home team goal in the 2010/2011 season in the country of Poland.
Evidence: average home team goal = AVG(home_team_goal) WHERE name = 'Poland' and season = '2010/2011';
SQL: SELECT CAST(SUM(t2.home_team_goal) AS REAL) / COUNT(t2.id) FROM Country AS t1 INNER JOIN Match AS t2 ON t1.id = t2.country_id WHERE t1.name = 'Poland' AND t2.season = '2010/2011'
Database: european_football_2
Question: From 2010 to 2015, what was the average overall rating of players who are higher than 170?
Evidence: from 2010 to 2015 refers to strftime('%Y', date) BETWEEN '2010' AND '2015'; height > 170;
SQL: SELECT CAST(SUM(t2.overall_rating) AS REAL) / COUNT(t2.id) FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id WHERE t1.height > 170 AND SUBSTR(t2.`date`, 1, 4) BETWEEN '2010' AND '2015'
Database: european_football_2
Question: What is the difference of the average ball control score between Abdou Diallo and Aaron Appindangoye
?
Evidence: difference of the average ball control = SUBTRACT(AVG(ball_control WHERE player_name = 'Abdou Diallo'), AVG(ball_control WHERE player_name = 'Aaron Appindangoye'));
SQL: SELECT CAST(SUM(CASE WHEN t1.player_name = 'Abdou Diallo' THEN t2.ball_control ELSE 0 END) AS REAL) / COUNT(CASE WHEN t1.player_name = 'Abdou Diallo' THEN t2.id ELSE NULL END) - CAST(SUM(CASE WHEN t1.player_name = 'Aaron Appindangoye' THEN t2.ball_control ELSE 0 END) AS REAL) / COUNT(CASE WHEN t1.player_name = 'Aaron Appindangoye' THEN t2.id ELSE NULL END) FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id
Database: european_football_2
Question: Which player is older, Aaron Lennon or Abdelaziz Barrada?
Evidence: older player refers to older birthday;
SQL: SELECT player_name FROM Player WHERE player_name IN ('Aaron Lennon', 'Abdelaziz Barrada') ORDER BY birthday ASC LIMIT 1
Database: european_football_2
Question: Among the players whose preferred foot was the left foot when attacking, how many of them would remain in his position when the team attacked?
Evidence: preferred foot when attacking refers to preferred foot; preferred_foot = 'left'; players who would remain in his position when the team attacked refers to attacking_work_rate = 'low';
SQL: SELECT COUNT(player_api_id) FROM Player_Attributes WHERE preferred_foot = 'left' AND attacking_work_rate = 'low'
Database: european_football_2
Question: Among the players born before the year 1986, how many of them would remain in his position and defense while the team attacked?
Evidence: players born before the year 1986 refers to strftime('%Y', birthday)<'1986'; players who would remain in his position and defense while the team attacked refers to defensive_work_rate = 'high';
SQL: SELECT COUNT(DISTINCT t1.player_name) FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id WHERE SUBSTR(t1.birthday, 1, 4) < '1986' AND t2.defensive_work_rate = 'high'
Database: european_football_2
Question: Please list the names of the players whose volley score and dribbling score are over 70.
Evidence: volley score refers to volleys; volleys > 70; dribbling score refers to dribbling; dribbling > 70;
SQL: SELECT DISTINCT t1.player_name FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id WHERE t2.volleys > 70 AND t2.dribbling > 70
Database: european_football_2
Question: How many matches were held in the Belgium Jupiler League in April, 2009?
Evidence: Belgium Jupiler League refers to League.name = 'Belgium Jupiler League'; in April, 2009 refers to strftime('%Y', date) = '2009' AND strftime('%m', date) = '04';
SQL: SELECT COUNT(t2.id) FROM League AS t1 INNER JOIN Match AS t2 ON t1.id = t2.league_id WHERE t1.name = 'Belgium Jupiler League' AND SUBSTR(t2.`date`, 1, 4) = '2009'
Database: european_football_2
Question: Which league had the most matches in the 2008/2009 season?
Evidence: league that had the most matches in the 2008/2009 season refers to MAX(league_id WHERE season = '2008/2009');
SQL: SELECT t1.name FROM League AS t1 INNER JOIN Match AS t2 ON t1.id = t2.league_id WHERE t2.season = '2008/2009' GROUP BY t1.name ORDER BY COUNT(t2.id) DESC LIMIT 1
Database: european_football_2
Question: What is Ajax's highest chance creation passing score and what is it classified as?
Evidence: Ajax's refers to team_long_name = 'Ajax'; chance creation passing score refers to MAX(chanceCreationPassing); classified as chanceCreationPassingClass
SQL: SELECT t2.chanceCreationPassing, t2.chanceCreationPassingClass FROM Team AS t1 INNER JOIN Team_Attributes AS t2 ON t1.team_api_id = t2.team_api_id WHERE t1.team_long_name = 'Ajax' ORDER BY t2.chanceCreationPassing DESC LIMIT 1
Database: european_football_2
Question: For the players who had a 77 points overall rating on 2016/6/23, who was the oldest? Give the name of the player.
Evidence: 77 points overall rating refers to overall_rating = 77; on 2016/6/23; oldest refers to MIN(birthday)
SQL: SELECT t1.player_name FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id WHERE SUBSTR(t2.`date`, 1, 10) = '2016-06-23' AND t2.overall_rating = 77 ORDER BY t1.birthday ASC LIMIT 1
Database: european_football_2
Question: What was the overall rating for Aaron Mooy on 2016/2/4?
Evidence: Aaron Mooy refers to player_name = 'Aaron Mooy'; on 2016/2/4 refers to date = '2016-02-04 00:00:00'
SQL: SELECT t2.overall_rating FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id WHERE SUBSTR(t2.`date`, 1, 10) = '2016-02-04' AND t1.player_name = 'Aaron Mooy'
Database: european_football_2
Question: How was Francesco Migliore's attacking work rate on 2015/5/1?
Evidence: Francesco Migliore's  refers to player_name = 'Francesco Migliore'; on 2015/5/1 refers to date = '2015-05-01 00:00:00'
SQL: SELECT t2.attacking_work_rate FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id WHERE SUBSTR(t2.`date`, 1, 10) = '2015-05-01' AND t1.player_name = 'Francesco Migliore'
Database: european_football_2
Question: What was the build up play speed class for "Willem II" on 2011/2/22?
Evidence: "Willem II" refers to team_long_name = 'Willem II'; on 2011/2/22 refers to date = '2012-02-22 00:00:00'
SQL: SELECT t2.buildUpPlaySpeedClass FROM Team AS t1 INNER JOIN Team_Attributes AS t2 ON t1.team_api_id = t2.team_api_id WHERE t1.team_long_name = 'Willem II' AND SUBSTR(t2.`date`, 1, 10) = '2011-02-22'
Database: european_football_2
Question: Tell the build Up play passing class for "FC Lorient" on 2010/2/22.
Evidence: "FC Lorient" refers to team_long_name = 'FC Lorient'; on 2010/2/22  refers to date = '2010-02-22
SQL: SELECT t2.buildUpPlayPassingClass FROM Team AS t1 INNER JOIN Team_Attributes AS t2 ON t1.team_api_id = t2.team_api_id WHERE t1.team_long_name = 'FC Lorient' AND SUBSTR(t2.`date`, 1, 10) = '2010-02-22'
Database: european_football_2
Question: For the team "Hannover 96", what was its defence aggression class on 2015/9/10?
Evidence: "Hannover 96" refers to team_long_name = 'Hannover 96'; on 2015/9/10 refers to date = '2015-09-10 00:00:00'
SQL: SELECT t2.chanceCreationShootingClass FROM Team AS t1 INNER JOIN Team_Attributes AS t2 ON t1.team_api_id = t2.team_api_id WHERE t1.team_long_name = 'Hannover 96' AND SUBSTR(t2.`date`, 1, 10) = '2015-09-10'
Database: european_football_2
Question: What was the average overall rating for Marko Arnautovic from 2007/2/22 to 2016/4/21?
Evidence: average overall rating refers to avg(overall_rating); Marko Arnautovic refers to player_name = 'Marko Arnautovic'; from 2007/2/22 to 2016/4/21 refers to date BETWEEN '2007-02-22 00:00:00' and '2016-04-21 00:00:00'
SQL: SELECT CAST(SUM(t2.overall_rating) AS REAL) / COUNT(t2.id) FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_fifa_api_id = t2.player_fifa_api_id WHERE t1.player_name = 'Marko Arnautovic' AND SUBSTR(t2.`date`, 1, 10) BETWEEN '2007-02-22' AND '2016-04-21'
Database: european_football_2
Question: What percentage is Landon Donovan's overall rating higher than Jordan Bowery on 2013/7/12?
Evidence: Landon Donovan's refers to player_name = 'Landon Donovan'; Jordan Bowery refers to player_name = 'Jordan Bowery';  percentage refers to DIVIDE(SUBTRACT(player_name = 'Landon Donovan' overall_rating; player_name = 'Jordan Bowery' overall_rating), player_name = 'Landon Donovan' overall_rating)*100
SQL: SELECT (SUM(CASE WHEN t1.player_name = 'Landon Donovan' THEN t2.overall_rating ELSE 0 END) * 1.0 - SUM(CASE WHEN t1.player_name = 'Jordan Bowery' THEN t2.overall_rating ELSE 0 END)) * 100 / SUM(CASE WHEN t1.player_name = 'Landon Donovan' THEN t2.overall_rating ELSE 0 END) LvsJ_percent FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_fifa_api_id = t2.player_fifa_api_id WHERE SUBSTR(t2.`date`, 1, 10) = '2013-07-12'
Database: european_football_2
Question: List down 5 tallest players' name.
Evidence: tallest refers to MAX(height)
SQL: SELECT player_name FROM Player ORDER BY height DESC LIMIT 5
Database: european_football_2
Question: State 10 names of the strongest players.
Evidence: strongest players refers to MAX(overall_rating)
SQL: SELECT DISTINCT t1.player_name FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id ORDER BY t2.overall_rating DESC LIMIT 10
Database: european_football_2
Question: Please provide top three football players' IDs who are among the lowest potential players and prefer to use the right foot when attacking.
Evidence: lowest potential players refers to MIN(potential); prefer to use the right foot refers to preferred_foot = 'right'
SQL: SELECT id FROM Player_Attributes WHERE preferred_foot = 'right' ORDER BY potential DESC LIMIT 3
Database: european_football_2
Question: How many players had the highest potential score for crossing that preferred to use their left foots while attacking?
Evidence: highest potential score for crossing refers to MAX(crossing); preferred to use their left foots refers to preferred_foot = 'left'
SQL: SELECT COUNT(t1.id) FROM Player_Attributes AS t1 WHERE t1.preferred_foot = 'left' AND t1.crossing = ( SELECT MAX(crossing) FROM Player_Attributes)
Database: european_football_2
Question: What was the final score for the match on September 24, 2008, in the Belgian Jupiler League between the home team and the away team?
Evidence: September 24, 2008 refers to date like '2008-09-24%'; final score for home team refers to home_team_goal; final score for away team refers to away_team_goal
SQL: SELECT t2.home_team_goal, t2.away_team_goal FROM League AS t1 INNER JOIN Match AS t2 ON t1.id = t2.league_id WHERE t1.name = 'Belgium Jupiler League' AND SUBSTR(t2.`date`, 1, 10) = '2008-09-24'
Database: european_football_2
Question: Please state the finishing rate and curve score of the player who has the heaviest weight.
Evidence: heaviest weight refers to MAX(weight)
SQL: SELECT id, finishing, curve FROM Player_Attributes WHERE player_api_id = ( SELECT player_api_id FROM Player ORDER BY weight DESC LIMIT 1 ) LIMIT 1
Database: european_football_2
Question: Which league had the most games in the 2015–2016 season?
Evidence: in the 2015–2016 season season = '2015/2016'; league with most games refers to team_long_name where MAX(COUNT(id))
SQL: SELECT t1.name FROM League AS t1 INNER JOIN Match AS t2 ON t1.id = t2.league_id WHERE t2.season = '2015/2016' GROUP BY t1.name ORDER BY COUNT(t2.id) DESC LIMIT 1
Database: european_football_2
Question: What is the percentage of players that are under 180 cm who have an overall strength of more than 70?
Evidence: percentage refers to DIVIDE(COUNT(height < 180 AND overall_rating > 70),COUNT(id)) * 100%
SQL: SELECT CAST(COUNT(CASE WHEN t2.overall_rating > 70 THEN t1.id ELSE NULL END) AS REAL) * 100 / COUNT(t1.id) percent FROM Player AS t1 INNER JOIN Player_Attributes AS t2 ON t1.player_api_id = t2.player_api_id WHERE t1.height < 180
Database: thrombosis_prediction
Question: Are there more in-patient or outpatient who were male? What is the deviation in percentage?
Evidence: male refers to SEX = 'M'; in-patient refers to Admission = '+'; outpatient refers to Admission = '-'; SUBTRACT(COUNT(ID) where SEX = 'M' and Admission = '+', COUNT(ID) where SEX  = 'M' and Admission = '-')
SQL: SELECT CAST(SUM(CASE WHEN Admission = '+' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN Admission = '-' THEN 1 ELSE 0 END) FROM Patient WHERE SEX = 'M'
Database: thrombosis_prediction
Question: What is the ratio of outpatient to inpatient followed up treatment among all the 'SLE' diagnosed patient?
Evidence: 'SLE' refers to diagnosis; inpatient refers to Admission = '+'; outpatient refers to Admission = '-'; DIVIDE(COUNT(ID) where Diagnosis = 'SLE' and Admission = '+', COUNT(ID) where Diagnosis = 'SLE' and Admission = '-')
SQL: SELECT SUM(CASE WHEN Admission = '+' THEN 1 ELSE 0 END) / SUM(CASE WHEN Admission = '-' THEN 1 ELSE 0 END) FROM Patient WHERE Diagnosis = 'SLE'
Database: thrombosis_prediction
Question: What is the disease patient '30609' diagnosed with. List all the date of laboratory tests done for this patient.
Evidence: '30609' is an ID; disease means diagnosis
SQL: SELECT T1.Diagnosis, T2.Date FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T1.ID = 30609
Database: thrombosis_prediction
Question: List the patient ID, sex and birthday of patient with LDH beyond normal range.
Evidence: LDH beyond normal range refers to LDH > '500'
SQL: SELECT DISTINCT T1.ID, T1.SEX, T1.Birthday FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.LDH > 500
Database: thrombosis_prediction
Question: State the ID and age of patient with positive degree of coagulation.
Evidence: age refers to SUBTRACT(year(current_timestamp), year(Birthday)); positive degree of coagulation refers to RVVT = '+'
SQL: SELECT DISTINCT T1.ID, STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', T1.Birthday) FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE T2.RVVT = '+'
Database: thrombosis_prediction
Question: For patients with severe degree of thrombosis, list their ID, sex and dieseas the patient is diagnosed with.
Evidence: severe degree of thrombosis refers to thrombosis = 2; disease refers to diagnosis
SQL: SELECT DISTINCT T1.ID, T1.SEX, T1.Diagnosis FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE T2.Thrombosis = 2
Database: thrombosis_prediction
Question: How many female patients who came at the hospital in 1997 was immediately followed at the outpatient clinic?
Evidence: female refers to sex = 'F'; came at the hospital in 1997 refers to year(Description) = '1997'; followed at the outpatient clinic refers to Admission = '-'
SQL: SELECT COUNT(*) FROM Patient WHERE STRFTIME('%Y', Description) = '1997' AND SEX = 'F' AND Admission = '-'
Database: thrombosis_prediction
Question: What was the age of the youngest patient when they initially arrived at the hospital?
Evidence: age refers to SUBTRACT(YEAR(Birthday), YEAR(`First Date`))
SQL: SELECT MIN(STRFTIME('%Y', `First Date`) - STRFTIME('%Y', Birthday)) FROM Patient
Database: thrombosis_prediction
Question: How many of the patients with the most serious thrombosis cases examined in 1997 are women?
Evidence: the most serious thrombosis refers to Thrombosis = '1' (the most severe one); women refers to sex = 'F'
SQL: SELECT CAST(SUM(CASE WHEN T1.SEX = 'F' THEN 1 ELSE 0 END) AS REAL) / COUNT(*) FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE STRFTIME('%Y', T2.`Examination Date`) = '1997' AND T2.Thrombosis = 1
Database: thrombosis_prediction
Question: What are the symptoms observed by the youngest patient to ever did a medical examination? Identify their diagnosis.
Evidence: the youngest patient refers to MIN(BIRTHDAY);
SQL: SELECT T2.Symptoms, T1.Diagnosis FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE T2.Symptoms IS NOT NULL ORDER BY T1.Birthday DESC LIMIT 1
Database: thrombosis_prediction
Question: The oldest SJS patient's medical laboratory work was completed on what date, and what age was the patient when they initially arrived at the hospital?
Evidence: The oldest patient refers to MAX(Birthday); 'SJS' refers to diagnosis; (SUBTRACT(year(`First Date`)), year(Birthday)); age of the patients when they initially arrived at the hospital refers to year(Birthday)
SQL: SELECT T1.Date, STRFTIME('%Y', T2.`First Date`) - STRFTIME('%Y', T2.Birthday) FROM Laboratory AS T1 INNER JOIN Patient AS T2 ON T1.ID = T2.ID WHERE T2.Diagnosis = 'SJS' AND T2.Birthday IS NOT NULL ORDER BY T2.Birthday ASC LIMIT 1
Database: thrombosis_prediction
Question: How many underage patients were examined during the course of the three-year period from 1990 to 1993?
Evidence: underage patients refers to year(Birthday) < 18; three-year period from 1990 to 1993 refers to `Examination Date` between '1990-01-01' and '1993-12-31'
SQL: SELECT COUNT(T1.ID) FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE STRFTIME('%Y', T2.`Examination Date`) BETWEEN '1990' AND '1993' AND STRFTIME('%Y', T2.`Examination Date`) - STRFTIME('%Y', T1.Birthday) < '18'
Database: thrombosis_prediction
Question: How many male patients have elevated total bilirubin count?
Evidence: male refers to SEX = 'M'; elevated means above the normal range; total bilirubin above the normal range refers to `T-BIL` > '2.0'
SQL: SELECT COUNT(DISTINCT T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.`T-BIL` >= 2.0 AND T1.SEX = 'M'
Database: thrombosis_prediction
Question: What is the average age of patients examined in the laboratory for the October of the year 1991?
Evidence: average age for first half of 1999 refers to AVG(SUBTRACT('1999', year(Birthday))); October of 1991 refers to Date BETWEEN '1991-10-01' AND '1991-10-30'
SQL: SELECT AVG('1999' - STRFTIME('%Y', T2.Birthday)) FROM Laboratory AS T1 INNER JOIN Patient AS T2 ON T1.ID = T2.ID WHERE T1.Date BETWEEN '1991-10-01' AND '1991-10-30'
Database: thrombosis_prediction
Question: For the patient who was diagnosed with SLE on 1994/2/19, what was his/her anti-Cardiolipin antibody concentration status on 1993/11/12?
Evidence: 'SLE' refers to Diagnosis; 1994/2/19 refers to Description = '1994-02-19'; anti-Cardiolipin refers to aCL IgM; 1993/11/12 refers to Description = '1993/11/12'
SQL: SELECT `aCL IgA`, `aCL IgG`, `aCL IgM` FROM Examination WHERE ID IN ( SELECT ID FROM Patient WHERE Diagnosis = 'SLE' AND Description = '1994-02-19' ) AND `Examination Date` = '1993-11-12'
Database: thrombosis_prediction
Question: For the patient who got the laboratory test of uric acid level as 8.4 on 1991-10-21, how old was he/she at that time?
Evidence: how old at that time refers to SUBTRACT('1992', year(Birthday)); uric acid level as 8.4 refers to UA = '8.4'; 1991/10/21 refers to Date = '1991-10-21'
SQL: SELECT STRFTIME('%Y', T2.Date) - STRFTIME('%Y', T1.Birthday) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.UA = 8.4 AND T2.Date = '1991-10-21'
Database: thrombosis_prediction
Question: List all patients who were followed up at the outpatient clinic who underwent a laboratory test in October 1991 and had a total blood bilirubin level within the normal range.
Evidence: followed up at the outpatient clinic refers to Admission = '-'; laboratory test in April 1981 refers to Date like '1991-10%'; blood bilirubin level within the normal range refers to T-BIL < 2.0
SQL: SELECT DISTINCT T1.ID FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T1.Admission = '-' AND T2.`T-BIL` < 2.0 AND STRFTIME('%Y', T2.Date) = '1991' AND STRFTIME('%m', T2.Date) = '10'
Database: thrombosis_prediction
Question: Excluding all P only ANA Pattern patients, how many of the remainder are women born between 1980 and 1989?
Evidence: Excluding all P only ANA Pattern refers to `ANA Pattern`! = 'p'; women refers to SEX = 'F'; born between 1980 and 1989 refers to BIRTHDAY
SQL: SELECT COUNT(DISTINCT T1.ID) FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE T2.`ANA Pattern` != 'P' AND STRFTIME('%Y', T1.Birthday) BETWEEN '1980' AND '1989' AND T1.SEX = 'F'
Database: thrombosis_prediction
Question: What is the average blood albumin level for female patients with a PLT greater than 400 who have been diagnosed with SLE?
Evidence: average blood albumin level refers to AVG(ALB); female refers to SEX = 'F'; PLT greater than 400 refers to PLT > 400; 'SLE' refers to diagnosis
SQL: SELECT AVG(T2.ALB) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.PLT > 400 AND T1.Diagnosis = 'SLE' AND T1.SEX = 'F'
Database: thrombosis_prediction
Question: How many female patients were given an APS diagnosis?
Evidence: female refers to SEX = 'F'; 'APS' refers to diagnosis
SQL: SELECT COUNT(ID) FROM Patient WHERE SEX = 'F' AND Diagnosis = 'APS'
Database: thrombosis_prediction
Question: How many patients who underwent testing in 1997 had protein levels outside the normal range?
Evidence: underwent testing in 1997 refers to YEAR(DATE) = '1997'; protein levels within the normal range refers to tp > 6 and tp < 8.5
SQL: SELECT COUNT(ID) FROM Laboratory WHERE ALB <= 6.0 OR ALB >= 8.5 AND STRFTIME('%Y', Date) = '1997'
Database: thrombosis_prediction
Question: What proportion of patients who had signs of thrombocytopenia had SLE diagnosed?
Evidence: thrombocytopenia' refers to symptoms; 'SLE' refers to diagnosis; calculation =   DIVIDE(SUM(DIAGNOSIS LIKE '%ITP%'), SUM(DIAGNOSIS LIKE '%SLE%')) MULTIPLY 100
SQL: SELECT CAST(SUM(CASE WHEN Diagnosis = 'SLE' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(ID) FROM Examination WHERE Symptoms = 'thrombocytopenia'
Database: thrombosis_prediction
Question: What percentage of patients who were born in 1980 and were diagnosed with RA are women?
Evidence: born in 1980 refers to YEAR(BIRTHDAY) = '1980'; 'RA' refers to diagnosis; women refers to SEX = 'F'; calculation = DIVIDE((SEX = 'F'), COUNT(SEX)) where YEAR(BIRTHDAY) = '1980' AND diagnosis = 'RA' MULTIPLY 100
SQL: SELECT CAST(SUM(CASE WHEN SEX = 'F' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(ID) FROM Patient WHERE Diagnosis = 'RA' AND STRFTIME('%Y', Birthday) = '1980'
Database: thrombosis_prediction
Question: How many male patients who underwent testing between 1995 and 1997 and were subsequently diagnosed with BEHCET disease did not stay in the hospital for treatment?
Evidence: male refers to SEX = 'M'; underwent testing between 1995 and 1997 refers to `Examination Date` between '1995' and '1997'; BEHCET refers to diagnosis; did not stay in the hospital refers to Admission = '-'
SQL: SELECT COUNT(T1.ID) FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE T2.Diagnosis = 'Behcet' AND T1.SEX = 'M' AND STRFTIME('%Y', T2.`Examination Date`) BETWEEN '1995' AND '1997' AND T1.Admission = '-'
Database: thrombosis_prediction
Question: Was the patient with the number 57266's uric acid within a normal range?
Evidence: uric acid within a normal range refers to UA > 8.0 and SEX = 'M'; UA > 6.5 and SEX = 'F'
SQL: SELECT CASE WHEN (T1.SEX = 'F' AND T2.UA > 6.5) OR (T1.SEX = 'M' AND T2.UA < 8.0) THEN true ELSE false END FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T1.ID = 57266
Database: thrombosis_prediction
Question: Please provide the diagnosis of patients with ALT glutamic pylvic transaminase beyond the normal range by ascending order of their date of birth.
Evidence: ALT glutamic pylvic transaminase beyond the normal range refers to GPT > 60; ascending order of their date of birth refers to MAX(Birthday)
SQL: SELECT DISTINCT T1.Diagnosis FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.GPT > 60 ORDER BY T1.Birthday ASC
Database: thrombosis_prediction
Question: For all female patient with total protein (TP) beyond the normal index, what is the deviation of their TP idex from the normal.
Evidence: female refers to SEX = 'F'; total protein (TP) beyond the normal index refers to TP > 8.5;
deviation of TP index from normal refers to SUBTRACT(TP, 8.5)
SQL: SELECT T2.TP - 8.5 FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T1.SEX = 'F' AND T2.TP > 8.5
Database: thrombosis_prediction
Question: Sort in descending order all patients by birthday for male patient with albumin not within range.
Evidence: male = SEX = 'M'; albumin not within range refers to ALB < = 3.5 or ALB > = 5.5
SQL: SELECT DISTINCT T1.ID FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T1.SEX = 'M' AND (T2.ALB <= 3.5 OR T2.ALB >= 5.5) ORDER BY T1.Birthday
Database: thrombosis_prediction
Question: For all patients with normal uric acid (UA), what is the average UA index based on their latest laboratory examination result?
Evidence: uric acid (UA) with normal range refers to UA < 8.0 and SEX = 'M' or UA < 6.5 and SEX = 'F'; average UA index refers to AVG(UA)
SQL: SELECT AVG(T2.UA) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE (T2.UA > 6.5 AND T1.SEX = 'F') OR (T2.UA > 8.0 AND T1.SEX = 'M') AND T2.Date = ( SELECT MAX(Date) FROM Laboratory )
Database: thrombosis_prediction
Question: Provide all ID, sex and birthday of patients whose urea nitrogen (UN) just within the borderline of passing?
Evidence: urea nitrogen (UN) just within the borderline of passing refers to UN = 29
SQL: SELECT DISTINCT T1.ID, T1.SEX, T1.Birthday FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.UN = 29
Database: thrombosis_prediction
Question: List and group all patients by sex for total bilirubin (T-BIL) level not within the normal range.
Evidence: total bilirubin (T-BIL) not within normal range refers to T-BIL > = 2.0
SQL: SELECT DISTINCT CASE WHEN T1.SEX = 'F' THEN T1.ID END , CASE WHEN T1.SEX = 'M' THEN T1.ID END FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.`T-BIL` >= 2.0
Database: thrombosis_prediction
Question: What is the average age of the male patient with high cholesterol?
Evidence: average age = DIVIDE(SUM(SUBTRACT(YEAR(NOW()), YEAR(birthday))), COUNT(ID)); male patient refers to gender = 'M'; high cholesterol refers to `T-CHO` > = 250;
SQL: SELECT AVG(STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', T1.Birthday)) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.`T-CHO` >= 250 AND T1.SEX = 'M'
Database: thrombosis_prediction
Question: For all patients with triglyceride (TG) level beyond the normal range, how many are age more than 50 years?
Evidence: triglyceride (TG) level beyond the normal range refers to TG > = 200; more than 50 years of age = SUBTRACT(year(current_timestamp), year(Birthday)) > 50;
SQL: SELECT COUNT(DISTINCT T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.TG >= 200 AND STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', T1.Birthday) > 50
Database: thrombosis_prediction
Question: For patient born between 1936-1956, how many male patients have creatinine phosphokinase beyond the normal range?
Evidence: born between 1936-1956 refers to year(Birthday) BETWEEN '1936' AND '1956'; male patients refers to sex = 'M'; creatinine phosphokinase beyond the normal range refers to CPK > = 250;
SQL: SELECT COUNT(DISTINCT T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE STRFTIME('%Y', T1.Birthday) BETWEEN '1936' AND '1956' AND T1.SEX = 'M' AND T2.CPK >= 250
Database: thrombosis_prediction
Question: Provide ID, sex and age of patient who has blood glucose (GLU) not within normal range but with total cholesterol(T-CHO) within normal range.
Evidence: age = SUBTRACT(year(current_timestamp), year(Birthday)); blood glucose (GLU) not within normal range refers to GLU > = 180; total cholesterol(T-CHO) within normal range refers to `T-CHO` < 250;
SQL: SELECT DISTINCT T1.ID, T1.SEX , STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', T1.Birthday) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.GLU >= 180 AND T2.`T-CHO` < 250
Database: thrombosis_prediction
Question: List each patient's ID and blood glucose (GLU) index that were within normal range for patient's whose data was first recorded in 1991.
Evidence: blood glucose (GLU) index that were within normal range refers to GLU < 180; data that was first recorded in 1991 refers to year(Description) > = 1991;
SQL: SELECT DISTINCT T1.ID, T2.GLU FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE STRFTIME('%Y', T1.`First Date`) = '1991' AND T2.GLU < 180
Database: thrombosis_prediction
Question: What are the patient's diagnosis for those who has lower red blood blood cell? State their ID and age.
Evidence: patient's diagnosis refers to Diagnosis; lower red blood cell refers to RBC < 3.5; age = SUBTRACT(year(current_timestamp), year(Birthday));
SQL: SELECT T1.Diagnosis, T1.ID , STRFTIME('%Y', CURRENT_TIMESTAMP) -STRFTIME('%Y', T1.Birthday) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.RBC < 3.5
Database: thrombosis_prediction
Question: Among the patients who were diagnosed with SLE, who is the oldest with normal hemoglobin level. Provide the ID and sex.
Evidence: diagnosed with SLE refers to Diagnosis = 'SLE'; oldest refers to MIN(Birthday); normal hemoglobin level refers to 10 < HGB < 17;
SQL: SELECT T1.ID, T1.SEX FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T1.Diagnosis = 'SLE' AND T2.HGB > 10 AND T2.HGB < 17 ORDER BY T1.Birthday ASC LIMIT 1
Database: thrombosis_prediction
Question: For patients with abnormal platelet level, state the number of patients with lower than normal range. How is it compare to the number of patients with higher than normal range?
Evidence: abnormal platelet level refers to PLT < 100; platelet level lower than normal range refers to PLT < 100; how much = SUBTRACT(SUM(PLT < 100), SUM(PLT > 400)); platelet level higher than normal range refers to PLT > 400;
SQL: SELECT SUM(CASE WHEN T2.PLT < 100 THEN 1 ELSE 0 END) - SUM(CASE WHEN T2.PLT > 400 THEN 1 ELSE 0 END) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID
Database: thrombosis_prediction
Question: For laboratory examinations take in 1984, list all patients below 50 years old with normal platelet level.
Evidence: laboratory examinations take in 1984 refers to Date like '1984%'; below 50 years old = SUBTRACT(year(current_timestamp), year(Birthday)) < 50; normal platelet level refers to PLT between 100 and 400;
SQL: SELECT DISTINCT T1.ID FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.PLT BETWEEN 100 AND 400 AND STRFTIME('%Y', T2.Date) - STRFTIME('%Y', T1.Birthday) < 50 AND STRFTIME('%Y', T2.Date) = '1984'
Database: thrombosis_prediction
Question: For all patients who are older than 55 years old, what is the percentage of female who has abnormal prothrombin time (PT)?
Evidence: older than 55 years old = SUBTRACT(year(current_timestamp), year(Birthday)) > 55; percentage = MULTIPLY(DIVIDE(SUM(PT > = 14 AND SEX = 'F'), SUM(PT > = 14)), 1.0); female refers to Sex = 'F'; abnormal prothrombin time (PT) refers to PT > = 14;
SQL: SELECT CAST(SUM(CASE WHEN T2.PT >= 14 AND T1.SEX = 'F' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', T1.Birthday) > 55
Database: thrombosis_prediction
Question: For the patients with an abnormal activated partial prothrom bin time, how many of them have a mild thrombosis?
Evidence: abnormal activated partial prothrom bin time refers to APTT > 45; mild thrombosis refers to Thrombosis = 3; Only count ones without repetitive.
SQL: SELECT COUNT(DISTINCT T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID INNER JOIN Examination AS T3 ON T3.ID = T2.ID WHERE T3.Thrombosis = 3 AND T2.APTT > 45