birdsql/bird_sql_dev_20251106 huggingface dataset:
Database: european_football_2
Question: When was the first time did Kevin Constant have his highest crossing score? Give the date.
Evidence: Kevin Constant refers to player_name = 'Kevin Constant'; highest crossing score refers to MAX(crossing)
SQL:
SELECT `date` FROM ( SELECT t2.crossing, t2.`date` 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 = 'Kevin Constant' ORDER BY t2.crossing DESC) ORDER BY date DESC LIMIT 1
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'
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: How was the build up play dribbling class for "LEI" on 2015/9/10?
Evidence: "LEI" refers to team_short_name = 'LEI'; on 2015/9/10 refers to  date = '2015-09-10 00:00:00'
SQL:
SELECT t2.buildUpPlayDribblingClass 
FROM Team AS t1 
INNER JOIN Team_Attributes AS t2 ON t1.team_api_id = t2.team_api_id 
WHERE t1.team_short_name = 'LEI' 
  AND t2.`date` >= '2015-09-10 00:00:00' 
  AND t2.`date` < '2015-09-11 00:00:00'
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 LIKE '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 t2.`date` LIKE '2010-02-22%'
Database: european_football_2
Question: State the chance creation passing class for "PEC Zwolle" on 2013/9/20.
Evidence: "PEC Zwolle" refers to team_long_name = 'PEC Zwolle'; on 2013/9/20 refers to date = '2013-09-20 00:00:00'
SQL:
SELECT 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 = 'PEC Zwolle' AND SUBSTR(t2.`date`, 1, 10) = '2013-09-20'
Database: european_football_2
Question: What was the chance creation crossing class for "Hull City" on 2010/2/22?
Evidence: "Hull City" refers to team_long_name = 'Hull City'; on 2010/2/22 refers to date = '2010-02-22 00:00:00'
SQL:
SELECT t2.chanceCreationCrossingClass 
FROM Team AS t1 
INNER JOIN Team_Attributes AS t2 ON t1.team_api_id = t2.team_api_id 
WHERE t1.team_long_name = 'Hull City' 
  AND SUBSTR(t2.`date`, 1, 10) = '2010-02-22'
ORDER BY t2.id ASC 
LIMIT 1;
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 LIKE '2015-09-10%';
SQL:
SELECT t2.defenceAggressionClass 
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 t2.`date` LIKE '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 the first 10 characters of date BETWEEN '2007-02-22' and '2016-04-21'
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 the tallest players' name.
Evidence: tallest refers to rank based on the height in descending order; Most tallest players refers to rank = 1 
SQL:
SELECT player_name FROM (SELECT player_name, height, DENSE_RANK() OVER (ORDER BY height DESC) as rank FROM Player) WHERE rank = 1
Database: european_football_2
Question: What are the player api id of 10 heaviest players?
Evidence: heaviest refers to MAX(weight)
SQL:
SELECT player_api_id FROM Player ORDER BY weight DESC LIMIT 10
Database: european_football_2
Question: List down the name of players who are 35 years old and above.
Evidence: 35 years old and above refers to datetime(CURRENT_TIMESTAMP,'localtime') - datetime(birthday) > 34
SQL:
SELECT player_name FROM Player WHERE CAST((JULIANDAY('now') - JULIANDAY(birthday)) AS REAL) / 365 >= 35
Database: european_football_2
Question: How many home team goal have been scored by Aaron Lennon?
Evidence: Aaron Lennon refers to player_name = 'Aaron Lennon'
SQL:
SELECT SUM(t2.home_team_goal) FROM Player AS t1 INNER JOIN match AS t2 ON t1.player_api_id = t2.away_player_9 WHERE t1.player_name = 'Aaron Lennon'
Database: european_football_2
Question: Sum up the away team goal scored by both Daan Smith and Filipe Ferreira.
Evidence: Sum the away-team goals in matches where either player appears for the away team.
SQL:
SELECT SUM(m.away_team_goal)
FROM `Match` AS m
WHERE EXISTS (
  SELECT 1
  FROM Player AS p
  WHERE p.player_name IN ('Daan Smith', 'Filipe Ferreira')
    AND p.player_api_id IN (
      m.away_player_1, m.away_player_2, m.away_player_3, m.away_player_4, m.away_player_5,
      m.away_player_6, m.away_player_7, m.away_player_8, m.away_player_9, m.away_player_10, m.away_player_11
    )
);
Database: european_football_2
Question: Calculate the total home team goal scored by home teams whose player 1's age is 30 years old and below.
Evidence: age are 30 years old and below refers to SUBTRACT(datetime(CURRENT_TIMESTAMP,'localtime'), datetime(birthday) < 31)
SQL:
SELECT SUM(t2.home_team_goal) FROM Player AS t1 INNER JOIN Match AS t2 ON t1.player_api_id = t2.home_player_1 WHERE datetime(CURRENT_TIMESTAMP, 'localtime') - datetime(T1.birthday) < 31
Database: european_football_2
Question: State the name of the most strongest player.
Evidence: Strongest player refers to the player with the maximum value of strength (player strength) in the Player_Attributes table; "most strongest" means the maximum strength value; strength and overall_rating are independent fields (the latter is a comprehensive rating, not related to strength).
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.strength = (SELECT MAX(strength) FROM Player_Attributes) ORDER BY t1.player_name ASC;
Database: european_football_2
Question: What is the name of players with the highest potential?
Evidence: highest potential refers to MAX(potential)
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.potential DESC LIMIT 1
Database: european_football_2
Question: Who are the players that tend to be attacking when their mates were doing attack moves? List down their name.
Evidence: tend to be attacking when their mates were doing attack moves refers to attacking_work_rate = 'high';
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.attacking_work_rate = 'high'
Database: european_football_2
Question: Among the players with finishing rate of 1, pick the eldest player and state the player's name.
Evidence: eldest player refers to MAX(SUBTRACT(datetime(CURRENT_TIMESTAMP,'localtime'),datetime(birthday))); finishing rate of 1 refers to finishing = 1
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.finishing = 1
ORDER BY t1.birthday ASC
LIMIT 1;
Database: european_football_2
Question: State the names of players who played in matches held in Belgium.
SQL:
SELECT DISTINCT p.player_name
FROM Country AS c
JOIN `Match` AS m ON c.id = m.country_id
JOIN Player AS p ON p.player_api_id IN (
  m.home_player_1, m.home_player_2, m.home_player_3, m.home_player_4, m.home_player_5,
  m.home_player_6, m.home_player_7, m.home_player_8, m.home_player_9, m.home_player_10, m.home_player_11,
  m.away_player_1, m.away_player_2, m.away_player_3, m.away_player_4, m.away_player_5,
  m.away_player_6, m.away_player_7, m.away_player_8, m.away_player_9, m.away_player_10, m.away_player_11
)
WHERE c.name = 'Belgium';
Database: european_football_2
Question: Locate players with vision scores of 90 and above, state the country of these players.
Evidence: vision scores of 90 and above refers to vision > 89
SQL:
SELECT DISTINCT t4.name FROM Player_Attributes AS t1 INNER JOIN Player AS t2 ON t1.player_api_id = t2.player_api_id INNER JOIN Match AS t3 ON t2.player_api_id = t3.home_player_8 INNER JOIN Country AS t4 ON t3.country_id = t4.id WHERE t1.vision > 89
Database: european_football_2
Question: Which country has the highest average weight among all players who participated in matches in that country?
Evidence: Players are associated with countries through the matches they played in that country's league. All 22 players (11 home and 11 away) from each match should be considered.
SQL:
SELECT T1.name FROM Country AS T1 INNER JOIN Match AS T2 ON T1.id = T2.country_id INNER JOIN Player AS T3 ON T3.player_api_id IN (T2.home_player_1, T2.home_player_2, T2.home_player_3, T2.home_player_4, T2.home_player_5, T2.home_player_6, T2.home_player_7, T2.home_player_8, T2.home_player_9, T2.home_player_10, T2.home_player_11, T2.away_player_1, T2.away_player_2, T2.away_player_3, T2.away_player_4, T2.away_player_5, T2.away_player_6, T2.away_player_7, T2.away_player_8, T2.away_player_9, T2.away_player_10, T2.away_player_11) WHERE T3.weight IS NOT NULL GROUP BY T1.name ORDER BY AVG(T3.weight) DESC LIMIT 1
Database: european_football_2
Question: List down the long name for slow speed class team.
Evidence: slow speed class refers to buildUpPlaySpeedClass = 'Slow'; long name refers to team_long_name
SQL:
SELECT DISTINCT t1.team_long_name FROM Team AS t1 INNER JOIN Team_Attributes AS t2 ON t1.team_api_id = t2.team_api_id WHERE t2.buildUpPlaySpeedClass = 'Slow'
Database: european_football_2
Question: What are the short name of team who played safe while creating chance of passing?
Evidence: played safe while creating chance of passing refers to chanceCreationPassingClass = 'Safe'; short name of team refers to team_short_name
SQL:
SELECT DISTINCT t1.team_short_name FROM Team AS t1 INNER JOIN Team_Attributes AS t2 ON t1.team_api_id = t2.team_api_id WHERE t2.chanceCreationPassingClass = 'Safe'
Database: european_football_2
Question: What is the average height of players who participated in matches in Italy?
Evidence: average height refers to AVG(height); Italy refers to the country name
SQL:
SELECT AVG(T1.height) FROM Player AS T1 INNER JOIN Match AS T2 ON T1.player_api_id IN (T2.home_player_1, T2.home_player_2, T2.home_player_3, T2.home_player_4, T2.home_player_5, T2.home_player_6, T2.home_player_7, T2.home_player_8, T2.home_player_9, T2.home_player_10, T2.home_player_11, T2.away_player_1, T2.away_player_2, T2.away_player_3, T2.away_player_4, T2.away_player_5, T2.away_player_6, T2.away_player_7, T2.away_player_8, T2.away_player_9, T2.away_player_10, T2.away_player_11) INNER JOIN Country AS T3 ON T2.country_id = T3.id WHERE T3.name = 'Italy'
Database: european_football_2
Question: Please provide the names of top three football players who are over 180 cm tall in alphabetical order.
Evidence: over 180 cm tall refers to height > 180; name of football player refers to player_name
SQL:
SELECT player_name FROM Player WHERE height > 180 ORDER BY player_name LIMIT 3
Database: european_football_2
Question: How many football players born after the 1990s have the first name 'Aaron'?
Evidence: first name 'Aaron' refers to player_name LIKE 'Aaron%'; born after the 1990s refers to birthday > '1990'
SQL:
SELECT COUNT(id)
FROM Player
WHERE birthday > '1990' AND player_name LIKE 'Aaron%';
Database: european_football_2
Question: What is the difference between players 6 and 23's jumping scores?
Evidence: difference between players 6 and 23's jumping scores refers to SUBTRACT(jumping AND id = 6,jumping AND id = 23)
SQL:
SELECT SUM(CASE WHEN t1.id = 6 THEN t1.jumping ELSE 0 END) -
       SUM(CASE WHEN t1.id = 23 THEN t1.jumping ELSE 0 END)
FROM Player_Attributes AS t1;
Database: european_football_2
Question: Please provide top five 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 when attacking refers to preferred_foot = 'right'
SQL:
SELECT id FROM Player_Attributes WHERE preferred_foot = 'right' ORDER BY potential LIMIT 5
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 while attacking 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 percentage of players have a strength and stamina score of more than 80?
Evidence: strength and stamina score of more than 80 refers to stamina > 80 and strength > 80
SQL:
SELECT CAST(COUNT(CASE WHEN strength > 80 AND stamina > 80 THEN id ELSE NULL END) AS REAL) * 100 / COUNT(id) FROM Player_Attributes t
Database: european_football_2
Question: In what country did the Poland Ekstraklasa take place?
SQL:
SELECT name FROM Country WHERE id IN ( SELECT country_id FROM League WHERE name = 'Poland Ekstraklasa' )
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%'; in the Belgian Jupiler League refers to League.name = 'Belgium Jupiler League'; 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 t2.`date` LIKE '2008-09-24%'
Database: european_football_2
Question: What are Alexis Blin's latest sprint speed, agility, and acceleration scores?
Evidence: Alexis Blin's refers to player_name = 'Alexis Blin'; latest scores refer to the most recent date
SQL:
SELECT sprint_speed, agility, acceleration FROM Player_Attributes WHERE player_api_id IN ( SELECT player_api_id FROM Player WHERE player_name = 'Alexis Blin' ) ORDER BY date DESC LIMIT 1
Database: european_football_2
Question: Does the KSV Cercle Brugge team have a slow, balanced or fast speed class?
Evidence: KSV Cercle Brugge refers to team_long_name = 'KSV Cercle Brugge'; speed class refers to buildUpPlaySpeedClass
SQL:
SELECT DISTINCT t1.buildUpPlaySpeedClass FROM Team_Attributes AS t1 INNER JOIN Team AS t2 ON t1.team_api_id = t2.team_api_id WHERE t2.team_long_name = 'KSV Cercle Brugge'
Database: european_football_2
Question: In the 2015–2016 season, how many games were played in the Italian Serie A league?
SQL:
SELECT COUNT(t2.id) FROM League AS t1 INNER JOIN Match AS t2 ON t1.id = t2.league_id WHERE t1.name = 'Italy Serie A' AND t2.season = '2015/2016'
Database: european_football_2
Question: What was the highest score of the home team in the Netherlands Eredivisie league?
Evidence: highest score of the home team refers to MAX(home_team_goal)
SQL:
SELECT MAX(t2.home_team_goal) FROM League AS t1 INNER JOIN Match AS t2 ON t1.id = t2.league_id WHERE t1.name = 'Netherlands Eredivisie'
Database: european_football_2
Question: Please state the finishing rate and curve score of the player who has the heaviest weight.
Evidence: finishing rate refer to finishing; curve score refer to curve; 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 top 4 leagues had the most games in the 2015-2016 season?
Evidence: in the 2015-2016 season refers to season = '2015/2016'; top 4 leagues with most games refers to League.name ORDER BY COUNT(id) DESC LIMIT 4
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 4
Database: european_football_2
Question: Please provide the full name of the away team that scored the most goals.
Evidence: full name refers to team_long_name; away team refers to away_team_api_id; scored the most goals refers to MAX(away_team_goal)
SQL:
SELECT t2.team_long_name FROM Match AS t1 INNER JOIN Team AS t2 ON t1.away_team_api_id = t2.team_api_id ORDER BY t1.away_team_goal DESC LIMIT 1
Database: european_football_2
Question: Please name one player whose overall strength is the greatest.
Evidence: overall strength is the greatest refers to highest in overall rating
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 t2.overall_rating = (SELECT MAX(overall_rating) FROM Player_Attributes) ORDER BY t1.player_name 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 COUNT(height < 180 AND overall_rating > 70) / COUNT(height < 180) * 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 = '-'; percentage = DIVIDE(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 percentage of female patient were born after 1930?
Evidence: female refers to Sex = 'F'; patient who were born after 1930 refers to year(Birthday) > '1930'; calculation = DIVIDE(COUNT(ID) where year(Birthday) > '1930' and SEX = 'F'), (COUNT(ID) where SEX = 'F')
SQL:
SELECT CAST(SUM(CASE WHEN STRFTIME('%Y', Birthday) > '1930' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Patient WHERE SEX = 'F'
Database: thrombosis_prediction
Question: For patient born between Year 1930 to 1940, how many percent of them were inpatient?
Evidence: patient born between Year 1930 to 1940 refers to year(Birthday) BETWEEN '1930-01-01' AND '1940-12-31'; inpatient refers to Admission = '+'
SQL:
SELECT CAST(SUM(CASE WHEN Admission = '+' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Patient WHERE STRFTIME('%Y', Birthday) BETWEEN '1930' AND '1940'
Database: thrombosis_prediction
Question: What is the ratio of outpatient to inpatient followed up treatment among all the 'SLE' diagnosed patient?
Evidence: 'SLE' diagnosed patient means Diagnosis = 'SLE'; inpatient refers to Admission = '+'; outpatient refers to Admission = '-'; calculation = DIVIDE(COUNT(ID) where Diagnosis = 'SLE' and Admission = '-', COUNT(ID) where Diagnosis = 'SLE' and Admission = '+')
SQL:
SELECT SUM(CASE WHEN Admission = '-' THEN 1.0 ELSE 0 END) / NULLIF(SUM(CASE WHEN Admission = '+' THEN 1 ELSE 0 END), 0) 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 the Patient 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: State the sex and birthday of patient ID '163109'. When was the examination taken and what symptom does the patient had.
Evidence: When was the examination taken refers to `Examination Date`
SQL:
SELECT T1.SEX, T1.Birthday, T2.`Examination Date`, T2.Symptoms FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE T1.ID = 163109
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) AS Age 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 disease 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: List all patients who were born in 1937 whose total cholesterol was beyond the normal range.
Evidence: born in 1937 refers to extracting the year from the birthday; total cholesterol beyond normal range refers to T-CHO being at or above the clinical threshold for high cholesterol (250 mg/dL)
SQL:
SELECT DISTINCT T1.ID FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE STRFTIME('%Y', T1.Birthday) = '1937' AND T2.`T-CHO` >= 250
Database: thrombosis_prediction
Question: For patient with albumin level lower than 3.5, list their ID, sex and diagnosis.
Evidence: albumin level lower than 3.5 refers to ALB < 3.5;
SQL:
SELECT DISTINCT T1.ID, T1.SEX, T1.Diagnosis FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.ALB < 3.5
Database: thrombosis_prediction
Question: What is the percentage of female patient had total protein not within the normal range?
Evidence: female refers to sex = 'F'; total protein not within the normal range refers to TP < '6.0' or TP > '8.5'; calculation = DIVIDE((ID where sex = 'F' and TP < '6.0' or TP > '8.5'), COUNT(ID)) * 100
SQL:
SELECT CAST(SUM(CASE WHEN T1.SEX = 'F' AND (T2.TP < 6.0 OR T2.TP > 8.5) THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T1.SEX = 'F'
Database: thrombosis_prediction
Question: For in-patients, what is the average IgG concentration measured when they were age 50 or above?
Evidence: in-patient refers to Admission = '+'; age 50 and above refers to SUBTRACT(year(Examination Date), year(Birthday)) >= '50'; average anti-cardiolipin antibody (IgG) concentration refers to AVG(aCL IgG)
SQL:
SELECT AVG(T2.`aCL IgG`)
FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID 
WHERE STRFTIME('%Y', T2.`Examination Date`) - STRFTIME('%Y', T1.Birthday) >= 50 AND T1.Admission = '+'
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'; immediately 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(`First Date`),YEAR(Birthday))
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  COUNT(*) FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE T1.SEX = 'F' AND STRFTIME('%Y', T2.`Examination Date`) = '1997' AND T2.Thrombosis = 1
Database: thrombosis_prediction
Question: What is the age gap between the youngest and oldest patient with a normal triglyceride recorded?
Evidence: age gap refers to SUBTRACT(MAX(year(Birthday)) - MIN(year(Birthday))); normal triglyceride refers to tg > = 200
SQL:
SELECT STRFTIME('%Y', MAX(T1.Birthday)) - STRFTIME('%Y', MIN(T1.Birthday)) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.TG >= 200
Database: thrombosis_prediction
Question: What are the symptoms observed by the youngest patient to ever did a medical examination? Identify their diagnosis.
Evidence: The larger the birthday value, the younger the person is, and vice versa; symptoms observed refers to the symptoms is not NULL
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: For the year that concluded on December 31, 1998, how many male patients on average were tested in the lab each month?
Evidence: the year that concluded on December 31, 1998 refers to Date BETWEEN '1998-01-01' AND '1998-12-31'; male refers to SEX = 'M'; calculation = DIVIDE(COUNT(ID), 12)
SQL:
SELECT CAST(COUNT(T1.ID) AS REAL) / 12 FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE STRFTIME('%Y', T2.Date) = '1998' AND T1.SEX = 'M'
Database: thrombosis_prediction
Question: The oldest SJS patient's latest medical laboratory work was completed on what date, and what age was the patient when they initially arrived at the hospital?
Evidence: The larger the birthday value, the younger the person is, and vice versa; '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 Max(T1.Date) AS LatestLabDate, STRFTIME('%Y', T2.`First Date`) - STRFTIME('%Y', T2.Birthday) AS AgeFirstArrived,T2.Birthday FROM Laboratory AS T1 INNER JOIN Patient AS T2 ON T1.ID = T2.ID WHERE T2.ID = (SELECT ID FROM Patient WHERE Diagnosis = 'SJS' AND Birthday IS NOT NULL ORDER BY Birthday ASC LIMIT 1)
Database: thrombosis_prediction
Question: What is the ratio of male to female patients among all those with abnormal uric acid counts?
Evidence: male refers to SEX = 'M'; female refers to SEX = 'F'; abnormal uric acid refers to UA < = '8.0' where SEX = 'M', UA < = '6.5' where SEX = 'F'; calculation = DIVIDE(SUM(UA <= '8.0' and SEX = 'M'), SUM(UA <= '6.5 and SEX = 'F'))
SQL:
SELECT CAST(SUM(CASE WHEN T2.UA <= 8.0 AND T1.SEX = 'M' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T2.UA <= 6.5 AND T1.SEX = 'F' THEN 1 ELSE 0 END) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID
Database: thrombosis_prediction
Question: How many patients hadn't undergone a medical examination until at least a year following their initial hospital visit?
Evidence: at least a year refers to at least 365 days between the two dates
SQL:
SELECT COUNT(DISTINCT T1.ID) FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE T1.Admission = '+' AND JULIANDAY(T2.`Examination Date`) - JULIANDAY(T1.`First Date`) >= 365
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 year(`Examination Date`) between '1990' and '1993'
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 most common illness that doctors identified among the patients whose lab work was done between 1/1/1985 and 12/31/1995?
Evidence: the most common illness refers to MAX(COUNT(Diagnosis)); lab work between 1/1/1985 and 12/31/1995 refers to `Examination Date` inclusively between '1985-01-01' and '1995-12-31 '
SQL:
SELECT T2.Diagnosis FROM Examination AS T1 INNER JOIN Patient AS T2 ON T1.ID = T2.ID WHERE T1.`Examination Date` BETWEEN '1985-01-01' AND '1995-12-31' GROUP BY T2.Diagnosis ORDER BY COUNT(T2.Diagnosis) DESC, T2.Diagnosis DESC LIMIT 1
Database: thrombosis_prediction
Question: What is the average age of patients as of year 1999 examined in the laboratory for the October of the year 1991?
Evidence: average age of patients as of year 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: How old was the patient who had the highest hemoglobin count on the date of laboratory tests , and what is the doctor's diagnosis?
Evidence: How old the patient refers to SUBTRACT(year(`Laboratory.Date`), year(Birthday)); the highest hemoglobin count refers to MAX(HGB)
SQL:
SELECT STRFTIME('%Y', T2.Date) - STRFTIME('%Y', T1.Birthday), T1.Diagnosis FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.HGB = (SELECT MAX(HGB) FROM Laboratory)
Database: thrombosis_prediction
Question: What was the anti-nucleus antibody concentration level for the patient id 3605340 on 1996/12/2?
Evidence: anti-nucleus antibody refers to ANA; 1996/12/2 refers to `Examination Date` = '1996-12-02'
SQL:
SELECT ANA FROM Examination WHERE ID = 3605340 AND `Examination Date` = '1996-12-02'
Database: thrombosis_prediction
Question: Was the total cholesterol status for the patient id 2927464 on 1995-9-4 at the normal level?
Evidence: total cholesterol normal level refers to N < 250
SQL:
SELECT CASE WHEN `T-CHO` < 250 THEN 'Normal' ELSE 'Abnormal' END FROM Laboratory WHERE ID = 2927464 AND Date = '1995-09-04'
Database: thrombosis_prediction
Question: What was the gender of the first AORTITIS diagnosed patient?
Evidence: gender means SEX; 'AORTITIS' refers to Diagnosis;
SQL:
SELECT SEX FROM Patient WHERE Diagnosis = 'AORTITIS' AND `First Date` IS NOT NULL ORDER BY `First Date` ASC, ID DESC LIMIT 1
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: diagnosed with SLE refers to Diagnosis = 'SLE'; 1994/2/19 refers to Description = '1994-02-19'; anti-Cardiolipin refers to aCL IgM; 1993/11/12 refers to Examination Date = '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: Was the patient a man or a woman whose ALT glutamic pylvic transaminase status got 9 on 1992-6-12?
Evidence: man refers to SEX = 'M'; woman refers to SEX = 'F'; ALT glutamic pylvic transaminase status got 9 means GPT = 9; 1992/6/12 refers to Date = '1992-06-12';
SQL:
SELECT T1.SEX FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.GPT = 9 AND T2.Date = '1992-06-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(year(test date), 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: For the patient who first came to the hospital on 1991/6/13 who was diagnosed with SJS, what is the total number of his/her Laboratory tests in 1995?
Evidence: 1991/6/13 refers to `First Date` = '1991-06-13'; 'SJS' refers to Diagnosis; total number of his/her Laboratory tests refers to COUNT(ID); 1995 refers to Date
SQL:
SELECT COUNT(*) FROM Laboratory WHERE ID = ( SELECT ID FROM Patient WHERE `First Date` = '1991-06-13' AND Diagnosis = 'SJS' ) AND STRFTIME('%Y', Date) = '1995'
Database: thrombosis_prediction
Question: For the patient who was diagnosed SLE on 1997/1/27, what was his/her original diagnose when he/she came to the hospital for the first time?
Evidence: 'SLE' AND original diagnose refers to diagnosis; 1997/1/27 refer to `Examination Date` = '1997-01-27'; first came to the hospital refers to patient.`First Date`
SQL:
SELECT T1.Diagnosis 
FROM Patient AS T1 
INNER JOIN Examination AS T2 ON T1.ID = T2.ID 
WHERE T1.ID = ( 
    SELECT ID 
    FROM Examination 
    WHERE `Examination Date` = '1997-01-27' AND Diagnosis = 'SLE' 
    ORDER BY ID ASC 
    LIMIT 1 
) 
AND T2.`Examination Date` = T1.`First Date`
Database: thrombosis_prediction
Question: For the patient whose birthday was 1959/3/1, what symptoms did he/she have during the examination on 1993/9/27?
SQL:
SELECT T2.Symptoms FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE T1.Birthday = '1959-03-01' AND T2.`Examination Date` = '1993-09-27'
Database: thrombosis_prediction
Question: For the patient who was born on 1959/2/18, what is the decrease rate for his/her total cholesterol from November to December in 1981?
Evidence: born on 1959/2/18 refers to Birthday = '1959-02-18'; calculation = SUBTRACT(SUM(Birthday = '1959-02-18' and Date like '1981-11-%' THEN `T-CHO`), SUM(Birthday = '1959-02-18' and Date like '1981-12-%' THEN `T-CHO`))
SQL:
SELECT CAST((SUM(CASE WHEN T2.Date LIKE '1981-11-%' THEN T2.`T-CHO` ELSE 0 END) - SUM(CASE WHEN T2.Date LIKE '1981-12-%' THEN T2.`T-CHO` ELSE 0 END)) AS REAL) / SUM(CASE WHEN T2.Date LIKE '1981-12-%' THEN T2.`T-CHO` ELSE 0 END) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T1.Birthday = '1959-02-18'
Database: thrombosis_prediction
Question: Lists all patients by ID who were diagnosed with Behcet's and had their exams between 01/01/197 and 12/31/1997.
Evidence: 'Behcet' refers to diagnosis; exam between 01/01/1997 and 12/31/1997 refers to YEAR(Description) > = '1997-1-1' AND YEAR(Description) < '1998-1-1'
SQL:
SELECT ID FROM Examination WHERE `Examination Date` BETWEEN '1997-01-01' AND '1997-12-31' AND Diagnosis = 'Behcet'
Database: thrombosis_prediction
Question: How many patients who were examined between 1987/7/6 and 1996/1/31 had a GPT level greater than 30 and an ALB level less than 4? List them by their ID.
Evidence: examined between 1987/7/6 and 1996/1/31 refers to Date BETWEEN '1987-07-06' AND '1996-01-31'; GPT level greater than 30 refers to GPT > 30; ALB level less than 4 refers to ALB < 4
SQL:
SELECT DISTINCT ID FROM Laboratory WHERE Date BETWEEN '1987-07-06' AND '1996-01-31' AND GPT > 30 AND ALB < 4
Database: thrombosis_prediction
Question: How many female patients born in 1964 were admitted to the hospital? List them by ID.
Evidence: female refers to SEX = 'F'; born in 1964 refers to YEAR(Birthday) = 1964; admitted to the hospital refers to Admission = '+'
SQL:
SELECT ID FROM Patient WHERE STRFTIME('%Y', Birthday) = '1964' AND SEX = 'F' AND Admission = '+'
Database: thrombosis_prediction
Question: What number of patients with a degree of thrombosis level 2 and ANA pattern of only S, have a level of anti-Cardiolipin antibody (IgM) 20% higher than average?
Evidence: thrombosis level 2 refers to Thrombosis = 2; ANA pattern of only S refers to `ANA Pattern` = 'S'; average anti-Cardiolipin antibody (IgM) refers to AVG(`aCL IgM`); 20% higher than average means greater than 1.2 times the average value.
SQL:
SELECT COUNT(*) FROM Examination WHERE Thrombosis = 2 AND `ANA Pattern` = 'S' AND `aCL IgM` > (SELECT AVG(`aCL IgM`) * 1.2 FROM Examination WHERE Thrombosis = 2 AND `ANA Pattern` = 'S')
Database: thrombosis_prediction
Question: What percentage of patients with a proteinuria level within the normal range have a uric acid level below the normal range?
Evidence: proteinuria level within the normal range refers to `U-PRO` > 0 AND `U-PRO` < 30; uric acid level below the normal range refers to UA < = 6.5; calculation = MULTIPLY(DIVIDE(UA < = 6.5 AND 0 <`U-PRO` < 30, 0 < `U-PRO` < 30)，100)
SQL:
SELECT CAST(SUM(CASE WHEN UA <= 6.5 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(ID) FROM Laboratory WHERE CAST(`U-PRO` AS REAL) > 0 AND CAST(`U-PRO` AS REAL) < 30
Database: thrombosis_prediction
Question: What percentage of male patients who first presented to the hospital in 1981 were diagnosed with BEHCET?
Evidence: male refers to SEX = 'M'; first presented to the hospital in 1981 refers to first date; BEHCET refers to diagnosis
SQL:
SELECT CAST(SUM(CASE WHEN Diagnosis = 'BEHCET' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(ID) FROM Patient WHERE STRFTIME('%Y', `First Date`) = '1981' AND SEX = 'M'
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 = '-'; 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 T2.Date LIKE '1991-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 sex is the patient who in a medical examination was diagnosed with PSS and in a laboratory examination had a blood level of C-reactive protein de 2+, createnine 1 and LDH 123?
Evidence: PSS refers to diagnosis; blood level of C-reactive protein de 2+ refers to CRP = '2+'; createnine 1 refers to CRE = 1; LDH 123 refers to LDH = 123
SQL:
SELECT T1.SEX FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID INNER JOIN Laboratory AS T3 ON T3.ID = T2.ID WHERE T2.Diagnosis = 'PSS' AND T3.CRP = '2+' AND T3.CRE = 1.0 AND T3.LDH = 123
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; diagnosed with SLE refers to Diagnosis= 'SLE'
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: What is the most common sign of patients with SLE disease?
Evidence: most common sign refers to the symptom that appears most frequently; SLE refers to diagnosis
SQL:
SELECT Symptoms FROM Examination WHERE Diagnosis = 'SLE' GROUP BY Symptoms ORDER BY COUNT(Symptoms) DESC LIMIT 1
Database: thrombosis_prediction
Question: When was the medical information on patient number 48473 first documented, and what disease did she have?
Evidence: medical information first documented refers to Description; disease refers to diagnosis; patient number refers to id
SQL:
SELECT `First Date`, Diagnosis FROM Patient WHERE ID = 48473
Database: thrombosis_prediction
Question: How many female patients were given an APS diagnosis?
Evidence: female refers to SEX = 'F'; APS diagnosis refers to Diagnosis='APS'
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(DISTINCT ID) AS abnormal_protein_patient_count
FROM Laboratory
WHERE 
  (TP <= 6.0 OR TP >= 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 LIKE '%SLE%' THEN 1 ELSE 0 END) AS REAL) * 100 / NULLIF(COUNT(DISTINCT ID), 0) AS proportion
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 STRFTIME('%Y', Birthday) = '1980'; 'RA' refers to Diagnosis='RA' ; women refers to SEX = 'F'; calculation = (Number of female patients ÷ total patients) * 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: How many patients who were female got white blood cells that were below 3.5?
Evidence: female refers to SEX = 'F'; white blood cells that were below 3.5 refers to WBC < 3.5
SQL:
SELECT COUNT(T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.WBC < 3.5 AND T1.SEX = 'F'
Database: thrombosis_prediction
Question: How long did it take after patient number 821298 arrived at the hospital for the first time before her first evaluation began?
Evidence: MIN(JULIANDAY(`Examination Date`) - JULIANDAY(`First Date`)
SQL:
SELECT MIN(JULIANDAY(T3.`Examination Date`)) - JULIANDAY(T1.`First Date`) FROM Patient AS T1 INNER JOIN Examination AS T3 ON T1.ID = T3.ID WHERE T1.ID = 821298
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' OR 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: When is the laboratory examination of patient '48473' where his/her AST glutamic oxaloacetic transaminase (GOT) index is above the normal range.
Evidence: AST glutamic oxaloacetic transaminase (GOT) index is above the normal range refers to GOT > = 60; when refers to DATE
SQL:
SELECT Date FROM Laboratory WHERE ID = 48473 AND GOT >= 60
Database: thrombosis_prediction
Question: List all patients with their sex and date of birthday, whose AST glutamic oxaloacetic transaminase (GOT) index is within normal range for laboratory examination in 1994.
Evidence: AST glutamic oxaloacetic transaminase (GOT) index within normal range refers to values less than 60; examination in 1994 refers to laboratory tests conducted during the year 1994.
SQL:
SELECT DISTINCT T1.SEX, T1.Birthday FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.GOT < 60 AND STRFTIME('%Y', T2.Date) = '1994'
Database: thrombosis_prediction
Question: Provide IDs for male patients with ALT glutamic pylvic transaminase (GPT) that have history of ALT glutamic pylvic transaminase (GPT) exceed the normal range.
Evidence: male refers to SEX = 'M'; ALT glutamic pylvic transaminase (GPT) exceed the normal range refers to GPT > = 60
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.GPT >= 60
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;
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: What is the average index of the lactate dehydrogenase (LDH) for all patients with lactate dehydrogenase (LDH) within the normal range.
Evidence: average index of the lactate dehydrogenase (LDH) refers to AVG(LDH); (LDH) within the normal range refers to LDH < 500
SQL:
SELECT AVG(LDH) FROM Laboratory WHERE LDH < 500
Database: thrombosis_prediction
Question: Provide the ID and age of patient with lactate dehydrogenase (LDH) between 100-300 index above the normal range.
Evidence: age refers to SUBTRACT(year(current_timestamp), year(Birthday)); lactate dehydrogenase (LDH) between 100-300 index above the normal range refers to LDH between 600 and 800;
SQL:
SELECT DISTINCT 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.LDH > 600 AND T2.LDH < 800
Database: thrombosis_prediction
Question: For patients with alkaliphophatase (ALP) within normal range, were they treated as inpatient or outpatient?
Evidence: alkaliphophatase (ALP) within normal range refers to ALP < 300; inpatient refers to admission = '+'; outpatient refers to admission = '-'
SQL:
SELECT T1.Admission FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.ALP < 300
Database: thrombosis_prediction
Question: Name the ID of the patient who is born on the April 1st, 1982. Is his/her alkaliphophatase (ALP) within normal range?
Evidence: alkaliphophatase (ALP) within normal range refers to ALP < 300
SQL:
SELECT T1.ID , CASE WHEN T2.ALP < 300 THEN 'normal' ELSE 'abNormal' END FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T1.Birthday = '1982-04-01'