Chinastark/bird_dataset huggingface dataset:
Database: synthea
Question: During all the observations of Elly Koss, what was the highest Systolic Blood Pressure observed?
Evidence: the highest Systolic Blood Pressure refers to MAX(DESCRIPTION = 'Systolic Blood Pressure') from observations;
SQL: SELECT T2.value, T2.units FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.description = 'Systolic Blood Pressure' ORDER BY T2.VALUE DESC LIMIT 1
Database: synthea
Question: For how many times had Elly Koss have her Systolic Blood Pressure observed?
Evidence: Systolic Blood Pressure refers to DESCRIPTION = 'Systolic Blood Pressure';
SQL: SELECT COUNT(T2.description) FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.description = 'Systolic Blood Pressure'
Database: synthea
Question: The highest Systolic Blood Pressure was observed in which patient? Please give his or her full name.
Evidence: the highest Systolic Blood Pressure refers to MAX(DESCRIPTION = 'Systolic Blood Pressure') from observations; full name refers to first, last;
SQL: SELECT T1.first, T1.last FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T2.VALUE = ( SELECT MAX(VALUE) FROM observations WHERE description = 'Systolic Blood Pressure' ) LIMIT 1
Database: synthea
Question: For how long was Elly Koss required to take Acetaminophen?
Evidence: SUM(MULTIPLY(365, SUBTRACT(strftime('%Y', STOP), strftime('%Y', START))), MULTIPLY(30, SUBTRACT(strftime('%m', STOP), strftime('%m', START))), SUBTRACT(strftime('%d', STOP), strftime('%d', START))) where DESCRIPTION like 'Acetaminophen%';
SQL: SELECT strftime('%J', T2.STOP) - strftime('%J', T2.START) AS days FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.description LIKE 'Acetaminophen%'
Database: synthea
Question: Please list all the medication that are prescribed to Elly Koss.
Evidence: medication that are prescribed refers to DESCRIPTION from medications;
SQL: SELECT DISTINCT T2.description FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss'
Database: synthea
Question: Why did Elly Koss need to take Acetaminophen?
Evidence: why need to take Acetaminophen refers to REASONDESCRIPTION  where DESCRIPTION like 'Acetaminophen%' from medications;
SQL: SELECT T2.REASONDESCRIPTION FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.description LIKE 'Acetaminophen%'
Database: synthea
Question: What medication did Elly Koss take when she had Streptococcal sore throat?
Evidence: medication refers to DESCRIPTION from medications; Streptococcal sore throat refers to REASONDESCRIPTION like 'Streptococcal sore throat%';
SQL: SELECT T2.description FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.reasondescription = 'Streptococcal sore throat (disorder)'
Database: synthea
Question: Please give the full names of all the patients who had been prescribed with Acetaminophen.
Evidence: full name refers to first, last; prescribed with Acetaminophen refer to DESCRIPTION like 'Acetaminophen%' from medications;
SQL: SELECT DISTINCT T1.first, T1.last FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T2.description LIKE 'Acetaminophen%'
Database: synthea
Question: What was the condition of Elly Koss on 2009/1/8?
Evidence: condition on 2009/1/8 refers to DESCRIPTION from conditions where START = '2009-01-08';
SQL: SELECT T2.description FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.START = '2009-01-08'
Database: synthea
Question: For how long did Elly Koss's cystitis last?
Evidence: SUM(MULTIPLY(365, SUBTRACT(strftime('%Y', STOP), strftime('%Y', START))), MULTIPLY(30, SUBTRACT(strftime('%m', STOP), strftime('%m', START))), SUBTRACT(strftime('%d', STOP), strftime('%d', START))) where DESCRIPTION = 'Cystitis';
SQL: SELECT strftime('%J', T2.STOP) - strftime('%J', T2.START) AS days FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.description = 'Cystitis'
Database: synthea
Question: According to all the observations of Elly Koss, what was her average weight?
Evidence: DIVIDE(SUM(VALUE), COUNT(VALUE)) WHERE DESCRIPTION = 'Body Weight';
SQL: SELECT AVG(T2.VALUE), T2.units FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.description = 'Body Weight'
Database: synthea
Question: Among all the patients who once had cystitis, what was the percentage of them being married?
Evidence: DIVIDE(COUNT(marital = 'M'), COUNT(patient)) as percentage where DESCRIPTION = 'Cystitis';

SQL: SELECT CAST(SUM(CASE WHEN T1.marital = 'M' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T2.description = 'Cystitis'
Database: synthea
Question: Give the body height status of Mr. Vincent Wyman on 2010/8/2.
Evidence: body height status refers to DESCRIPTION = 'Body Height' from observations; on 2010/8/2 refers to DATE = '2010-08-02';
SQL: SELECT T2.description, T2.VALUE, T2.units FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Mr.' AND T1.first = 'Vincent' AND T1.last = 'Wyman' AND T2.date = '2010-08-02' AND T2.description = 'Body Height'
Database: synthea
Question: How many care plans has Mrs. Norman Berge taken?
SQL: SELECT COUNT(T2.PATIENT) FROM patients AS T1 INNER JOIN careplans AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Mrs.' AND T1.first = 'Norman' AND T1.last = 'Berge'
Database: synthea
Question: Why did Mrs. Annabelle Pouros take leucovorin 100 mg injection on 1970/12/19? State the reason.
Evidence: reason why take leucovorin 100 mg injection refers to REASONDESCRIPTION where DESCRIPTION = 'Leucovorin 100 MG Injection'; on 1970/12/19 refers to START = '1970-12-19';
SQL: SELECT T2.reasondescription FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Mrs.' AND T1.first = 'Annabelle' AND T1.last = 'Pouros' AND T2.start = '1970-12-19' AND T2.description = 'Leucovorin 100 MG Injection'
Database: synthea
Question: What is the prevalence percentage of condition no. 64859006?
Evidence: condition no. 64859006 refers to conditions where CODE = '64859006';
SQL: SELECT DISTINCT T1."PREVALENCE PERCENTAGE" FROM all_prevalences AS T1 INNER JOIN conditions AS T2 ON lower(T1.ITEM) = lower(T2.DESCRIPTION) WHERE T2.code = '64859006'
Database: synthea
Question: State the prevalence rate of condition no. 368581000119106.
Evidence: condition no. 368581000119106 refers to conditions where CODE = '368581000119106';
SQL: SELECT DISTINCT T1."PREVALENCE RATE" FROM all_prevalences AS T1 INNER JOIN conditions AS T2 ON lower(T1.ITEM) = lower(T2.DESCRIPTION) WHERE T2.code = '368581000119106'
Database: synthea
Question: Give the procedure description of Ms. Jacquelyn Shanahan on 2009/8/9.
Evidence: on 2009/8/9 refers to DATE = '2009-08-09';
SQL: SELECT DISTINCT T2.description FROM patients AS T1 INNER JOIN procedures AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Ms.' AND T1.first = 'Jacquelyn' AND T1.last = 'Shanahan' AND T2.DATE = '2009-08-09'
Database: synthea
Question: Give the number of claims did Ms. Abbie Cole have in the year of 2011.
Evidence: in the year of 2011 refers to BILLABLEPERIOD between '2010-12-31' and '2012-01-01';
SQL: SELECT COUNT(T2.BILLABLEPERIOD) FROM patients AS T1 INNER JOIN claims AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Ms.' AND T1.first = 'Abbie' AND T1.last = 'Cole' AND T2.BILLABLEPERIOD BETWEEN '2010-12-31' AND '2012-01-01'
Database: synthea
Question: How many allergies does Mrs. Saundra Monahan have?
Evidence: allergies refer to PATIENT from allergies;
SQL: SELECT COUNT(DISTINCT T2.code) FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Mrs.' AND T1.first = 'Saundra' AND T1.last = 'Monahan'
Database: synthea
Question: Provide the name of the patient who had a claim on 1947/9/11.
Evidence: name of the patient implies full name and refers to first, last; on 1947/9/11 refers to BILLABLEPERIOD = '1947-09-11';
SQL: SELECT T1.first, T1.last FROM patients AS T1 INNER JOIN claims AS T2 ON T1.patient = T2.PATIENT WHERE T2.billableperiod = '1947-09-11'
Database: synthea
Question: Describe the encounter of Mr. Hubert Baumbach on 2008/10/25.
Evidence: encounter refers to DESCRIPTION from encounters; on 2008/10/25 refers to DATE = '2008-10-25';
SQL: SELECT T2.description FROM patients AS T1 INNER JOIN encounters AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Mr.' AND T1.first = 'Hubert' AND T1.last = 'Baumbach' AND T2.date = '2008-10-25'
Database: synthea
Question: What kind of condition did Keven Kuhn have from 2016/9/24 to 2016/10/10? Describe the condition.
Evidence: kind of condition refers to DESCRIPTION from conditions; from 2016/9/24 to 2016/10/10 refers to START = '2016-09-24' and STOP = '2016-10-10';
SQL: SELECT T2.description FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Keven' AND T1.last = 'Kuhn' AND T2.start = '2016-09-24' AND T2.stop = '2016-10-10'
Database: synthea
Question: When did Mrs. Ira Deckow have the standard pregnancy test?
Evidence: standard pregnancy test refers to DESCRIPTION = 'Standard pregnancy test' from procedures;
SQL: SELECT T2.date FROM patients AS T1 INNER JOIN procedures AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Mrs.' AND T1.first = 'Ira' AND T1.last = 'Deckow' AND T2.description = 'Standard pregnancy test'
Database: synthea
Question: Calculate the average period of Mr. Wesley Lemke's care plans.
Evidence: DIVIDE(SUBTRACT(stop time - start time), COUNT(ID)));
SQL: SELECT CAST(SUM(strftime('%J', T2.STOP) - strftime('%J', T2.START)) AS REAL) / COUNT(T1.patient) FROM patients AS T1 INNER JOIN careplans AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Mr.' AND T1.first = 'Wesley' AND T1.last = 'Lemke'
Database: synthea
Question: State the average period of Ms. Angelena Kertzmann's several normal pregnancies.
Evidence: DIVIDE(SUBTRACT(stop time - start time), COUNT(DESCRIPTION = 'Normal pregnancy')));
SQL: SELECT CAST(SUM(strftime('%J', T2.STOP) - strftime('%J', T2.START)) AS REAL) / COUNT(T2.PATIENT) FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Ms.' AND T1.first = 'Angelena' AND T1.last = 'Kertzmann' AND T2.description = 'Normal pregnancy'
Database: synthea
Question: What is the id of the patient who has the longest allergy period?
Evidence: id of the patient refers to PATIENT from allergies where STOP is not null; the longest allergy period refers to MAX(SUBTRACT((SUBSTR(STOP, - 2, 1)! = '9' then substr(STOP, length(STOP) - 1) + 2000 end), (SUBSTR(START, - 2, 1) = '9' then substr(START, length(START) - 1) + 1900 else substr(START, length(START) - 1) + 2000 end)));

SQL: SELECT PATIENT FROM allergies WHERE STOP IS NOT NULL GROUP BY PATIENT ORDER BY CASE WHEN SUBSTR(STOP, -2, 1) != '9' THEN SUBSTR(STOP, LENGTH(STOP) - 1) + 2000 END - CASE WHEN SUBSTR(START, -2, 1) = '9' THEN SUBSTR(START, LENGTH(START) - 1) + 1900 ELSE SUBSTR(START, LENGTH(START) - 1) + 2000 END LIMIT 1
Database: synthea
Question: How many patients have diabetes that started in 1988?
Evidence: diabetes that started in 1988 refers to DESCRIPTION = 'Diabetes' from conditions and START like '1988%';
SQL: SELECT COUNT(PATIENT) FROM conditions WHERE DESCRIPTION = 'Diabetes' AND strftime('%Y', START) = '1988'
Database: synthea
Question: How many patients are allergic to eggs?
Evidence: allergic to eggs refer to DESCRIPTION = 'Allergy to eggs' from allergies;
SQL: SELECT COUNT(PATIENT) FROM allergies WHERE DESCRIPTION = 'Allergy to eggs'
Database: synthea
Question: What is the id of the patient whose hypertension started most recently?
Evidence: id of the patient refers to PATIENT from conditions;  hypertension refers to DESCRIPTION = 'Hypertension'; most recently refers to MAX(START);
SQL: SELECT PATIENT FROM conditions WHERE START = ( SELECT MAX(START) FROM conditions WHERE DESCRIPTION = 'Hypertension' )
Database: synthea
Question: What is the most common allergy among patients?
Evidence: the most common allergy refers to MAX(COUNT(DESCRIPTION)) from allergies;
SQL: SELECT DESCRIPTION FROM allergies GROUP BY DESCRIPTION ORDER BY COUNT(DESCRIPTION) DESC LIMIT 1
Database: synthea
Question: What is/are the ids of the tallest patient/s?
Evidence: id of the tallest patient/s refers to PATIENT from observations where MAX(DESCRIPTION = 'Body Height');
SQL: SELECT PATIENT FROM observations WHERE DESCRIPTION = 'Body Height' AND UNITS = 'cm' ORDER BY VALUE DESC LIMIT 1
Database: synthea
Question: What is the most common condition among the female Americans?
Evidence: the most common condition refers to MAX(COUNT(DESCRIPTION)); among the female Americans refer to PATIENT where gender = 'F' and ethnicity = 'american';
SQL: SELECT T2.DESCRIPTION FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T1.gender = 'F' AND T1.ethnicity = 'american' GROUP BY T2.DESCRIPTION ORDER BY COUNT(T2.DESCRIPTION) DESC LIMIT 1
Database: synthea
Question: Among the patients that started taking Ibuprofen 200mg Oral Tablet in 2016, how many Dominican patients stopped taking the medicine after exactly one month?
Evidence: Ibuprofen 200mg Oral Tablet refers to DESCRIPTION = 'Ibuprofen 200 MG Oral Tablet' from medications; started in 2016 refers to START like '2016%'; Dominican patients refer to ethnicity = 'dominican'; stopped taking the medicine after exactly one month refers to SUBTRACT(strftime('%m', STOP), strftime('%m', START)) = 1;
SQL: SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Ibuprofen 200 MG Oral Tablet' AND T1.ethnicity = 'dominican' AND strftime('%Y', T2.START) = '2016' AND strftime('%m', T2.STOP) - strftime('%m', T2.START) = 1
Database: synthea
Question: How many of the patients born in 1920s had pneumonia?
Evidence: patients born in 1920s refer to patient where birthdate like '192%'; pneumonia refers to DESCRIPTION = 'Pneumonia' from conditions;
SQL: SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE DESCRIPTION = 'Pneumonia' AND strftime('%Y', T1.birthdate) LIKE '192%'
Database: synthea
Question: What are the full names of the patients who started taking Yaz 28 Day Pack in 2011?
Evidence: full name refers to first, last; Yaz 28 Day Pack refers to DESCRIPTION = 'Yaz 28 Day Pack' from medications; started taking in 2011 refers to START like '2011%';
SQL: SELECT DISTINCT T1.first, T1.last, T1.suffix FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Yaz 28 Day Pack' AND strftime('%Y', T2.START) = '2011'
Database: synthea
Question: How many Black patients were immunized with DTaP in 2013?
Evidence: Black patients refer to patient where race = 'black'; immunized with DTaP refers to DESCRIPTION = 'DTaP' from immunizations; in 2013 refers to DATE like '2013%';
SQL: SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN immunizations AS T2 ON T1.patient = T2.PATIENT WHERE T1.race = 'black' AND T2.DESCRIPTION = 'DTaP' AND strftime('%Y', T2.DATE) = '2013'
Database: synthea
Question: How many immunizations did the patient with the most prevalent condition that started recently get?
Evidence: patient with the most prevalent condition refers to patient where MAX(PREVALENCE RATE); started recently refers to MAX(START);
SQL: SELECT COUNT(T2.patient) FROM all_prevalences AS T1 INNER JOIN conditions AS T2 ON lower(T1.ITEM) = lower(T2.DESCRIPTION) INNER JOIN immunizations AS T3 ON T2.PATIENT = T3.PATIENT GROUP BY T2.PATIENT ORDER BY T2.START DESC, T1."PREVALENCE RATE" DESC LIMIT 1
Database: synthea
Question: How many patients have the most prevalent conditions?
Evidence: the most prevalent conditions refer to MAX(PREVALENCE RATE);
SQL: SELECT COUNT(DISTINCT T2.patient) FROM all_prevalences AS T1 INNER JOIN conditions AS T2 ON lower(T1.ITEM) = lower(T2.DESCRIPTION) ORDER BY T1."PREVALENCE RATE" DESC LIMIT 1
Database: synthea
Question: What is the most common condition among the patients who received influenza seasonal injectable preservative free immunization?
Evidence: the most common condition refers to MAX(DESCRIPTION) from conditions; patients who received influenza seasonal injectable preservative free immunization refer to PATIENT where DESCRIPTION = 'Influenza seasonal injectable preservative free' from immunizations;
SQL: SELECT T2.DESCRIPTION FROM immunizations AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T1.DESCRIPTION = 'Influenza  seasonal  injectable  preservative free' GROUP BY T2.DESCRIPTION ORDER BY COUNT(T2.DESCRIPTION) DESC LIMIT 1
Database: synthea
Question: List the ids of all the patients with condition that has a prevalence percentage of 18.8%.
Evidence: ids of the patients refer to PATIENT from conditions; condition that has a prevalence percentage of 18.8% refers to PREVALENCE PERCENTAGE = 18.8;
SQL: SELECT DISTINCT T1.PATIENT FROM conditions AS T1 INNER JOIN all_prevalences AS T2 ON lower(T2.ITEM) = lower(T1.DESCRIPTION) WHERE T2."PREVALENCE PERCENTAGE" = CAST(18.8 AS float)
Database: synthea
Question: How many conditions did Tyree Eichmann have?
Evidence: conditions refer to DESCRIPTION from conditions;
SQL: SELECT COUNT(DISTINCT T2.DESCRIPTION) FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Tyree' AND T1.last = 'Eichmann'
Database: synthea
Question: Among the patients who were immunized with meningococcal MCV4P, how many have viral sinusitis disorder after getting the immunization?
Evidence: immunized with meningococcal MCV4P refers to DESCRIPTION = 'meningococcal MCV4P' from immunizations; viral sinusitis disorder refers to DESCRIPTION = 'Viral sinusitis (disorder)' from conditions;
SQL: SELECT COUNT(DISTINCT T1.patient) FROM immunizations AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T1.DESCRIPTION = 'meningococcal MCV4P' AND T2.DESCRIPTION = 'Viral sinusitis (disorder)'
Database: synthea
Question: Among the patients with prediabetes, how many are female?
Evidence: patients with prediabetes refer to PATIENT from conditions where DESCRIPTION = 'Prediabetes'; female refers to gender = 'F';
SQL: SELECT COUNT(DISTINCT T2.patient) FROM conditions AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T2.gender = 'F' AND T1.DESCRIPTION = 'Prediabetes'
Database: synthea
Question: Indicate the patient's full name with the lowest body mass index in kg/m2.
Evidence: full name refers to first, last; the lowest body mass index in kg/m2 refers to DESCRIPTION = Body Mass Index from observations where MIN(VALUE) and UNITS = 'kg/m2';
SQL: SELECT T1.first, T1.last FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Body Mass Index' AND T2.UNITS = 'kg/m2' ORDER BY T2.VALUE LIMIT 1
Database: synthea
Question: What is the age of the patient with hypertension named Giovanni Russel?
Evidence: age refers to SUBTRACT(strftime('%Y', deathdate), strftime('%Y', birthdate)); hypertension refers to conditions where DESCRIPTION = 'Hypertension';
SQL: SELECT strftime('%Y', T2.deathdate) - strftime('%Y', T2.birthdate) AS age FROM conditions AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T2.first = 'Giovanni' AND T2.last = 'Russel' AND T1.DESCRIPTION = 'Hypertension'
Database: synthea
Question: How many Asian female patients take oxaliplatin 5 MG/ML [Eloxatin]?
Evidence: female refers to gender = 'F'; oxaliplatin 5 MG/ML [Eloxatin] refers to medications where DESCRIPTION = 'oxaliplatin 5 MG/ML [Eloxatin]';
SQL: SELECT COUNT(DISTINCT T2.patient) FROM medications AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'oxaliplatin 5 MG/ML [Eloxatin]' AND T2.race = 'asian' AND T2.gender = 'F'
Database: synthea
Question: Count all of the living patients that had a stroke.
Evidence: if deathdate is null, it means this patient is still alive or living; stroke refers to conditions where DESCRIPTION = 'Stroke';
SQL: SELECT COUNT(DISTINCT T2.patient) FROM conditions AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.description = 'Stroke' AND T2.deathdate IS NULL
Database: synthea
Question: What is the total number of Asian patients who are allergic to peanuts?
Evidence: Asian refers to race like 'asian%'; allergic to peanuts refers to allergies where DESCRIPTION = 'Allergy to peanuts'; 

SQL: SELECT COUNT(T2.patient) FROM allergies AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'Allergy to peanuts' AND T2.race = 'asian'
Database: synthea
Question: Among the patients with hypertension, what is the average of their diastolic blood pressure?
Evidence: hypertension refers to conditions where DESCRIPTION = 'Hypertension'; average diastolic blood pressure refers to AVG(VALUE) where DESCRIPTION = 'Diastolic Blood Pressure' from observations;
SQL: SELECT AVG(T1.VALUE) FROM observations AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient INNER JOIN conditions AS T3 ON T2.patient = T3.PATIENT WHERE T3.DESCRIPTION = 'Hypertension' AND T1.DESCRIPTION = 'Diastolic Blood Pressure'
Database: synthea
Question: What is the medicine prescribed for the patient with social security number 999-94-3751?
Evidence: medicine prescribed refers to DESCRIPTION from medications; social security number 999-94-3751 refers to ssn = '999-94-3751';
SQL: SELECT T1.DESCRIPTION FROM medications AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T2.ssn = '999-94-3751'
Database: synthea
Question: Give the social security number of the female Irish patient allergic to grass pollen.
Evidence: social security number refers to ssn; female refers to gender = 'F'; Irish refers to ethnicity = 'irish'; allergic to grass pollen refers to allergies where DESCRIPTION = 'Allergy to grass pollen';
SQL: SELECT T2.ssn FROM allergies AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'Allergy to grass pollen' AND T2.ethnicity = 'irish' AND T2.gender = 'F'
Database: synthea
Question: Who is the patient involved in the care plan with code 311791003?
SQL: SELECT T2.first, T2.last FROM careplans AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.CODE = 315043002
Database: synthea
Question: Among the patients that died, what is the condition of the oldest patient?
Evidence: if deathdate is not null, it means this patient died; condition refers to DESCRIPTION from conditions; the oldest patient refers to MAX(SUBTRACT(strftime('%Y', deathdate), strftime('%Y', birthdate)));
SQL: SELECT T1.DESCRIPTION FROM conditions AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T2.deathdate IS NOT NULL ORDER BY strftime('%Y', T2.deathdate) - strftime('%Y', T2.birthdate) DESC LIMIT 1
Database: synthea
Question: What is the code of the prevalent disease with the highest occurrences?
SQL: SELECT T2.code FROM all_prevalences AS T1 INNER JOIN conditions AS T2 ON T1.ITEM = T2.DESCRIPTION ORDER BY T1.OCCURRENCES DESC LIMIT 1
Database: synthea
Question: What is the glucose level of the patient that lives at 365 Della Crossroad Suite 202, Deerfield, MA 01342 US?
Evidence: glucose level refers to VALUE, UNITS where DESCRIPTION = 'Glucose' from observations; lives at 365 Della Crossroad Suite 202, Deerfield, MA 01342 US refers to address = '365 Della Crossroad Suite 202 Deerfield MA 01342 US';
SQL: SELECT DISTINCT T2.DESCRIPTION, T2.VALUE, T2.UNITS FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Glucose' AND T1.address = '365 Della Crossroad Suite 202 Deerfield MA 01342 US'