Chinastark/bird_dataset huggingface dataset:
Database: synthea
Note: 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';
Question: Why did Mrs. Annabelle Pouros take leucovorin 100 mg injection on 1970/12/19? State the reason.
SQL: SELECT medications.reasondescription FROM patients INNER JOIN medications ON patients.patient = medications.patient WHERE patients.prefix = 'Mrs.' AND patients.first = 'Annabelle' AND patients.last = 'Pouros' AND medications.start = '1970-12-19' AND medications.description = 'Leucovorin 100 MG Injection'
Database: synthea
Note: condition no. 64859006 refers to conditions where code = '64859006';
Question: What is the prevalence percentage of condition no. 64859006?
SQL: SELECT DISTINCT all_prevalences."PREVALENCE PERCENTAGE" FROM all_prevalences INNER JOIN conditions ON lower(all_prevalences.item) = lower(conditions.description) WHERE conditions.code = '64859006'
Database: synthea
Note: condition no. 368581000119106 refers to conditions where code = '368581000119106';
Question: State the prevalence rate of condition no. 368581000119106.
SQL: SELECT DISTINCT all_prevalences."PREVALENCE RATE" FROM all_prevalences INNER JOIN conditions ON lower(all_prevalences.item) = lower(conditions.description) WHERE conditions.code = '368581000119106'
Database: synthea
Note: on 2009/8/9 refers to date = '2009-08-09';
Question: Give the procedure description of Ms. Jacquelyn Shanahan on 2009/8/9.
SQL: SELECT DISTINCT procedures.description FROM patients INNER JOIN procedures ON patients.patient = procedures.patient WHERE patients.prefix = 'Ms.' AND patients.first = 'Jacquelyn' AND patients.last = 'Shanahan' AND procedures.date = '2009-08-09'
Database: synthea
Note: in the year of 2011 refers to billableperiod between '2010-12-31' and '2012-01-01';
Question: Give the number of claims did Ms. Abbie Cole have in the year of 2011.
SQL: SELECT count(claims.billableperiod) FROM patients INNER JOIN claims ON patients.patient = claims.patient WHERE patients.prefix = 'Ms.' AND patients.first = 'Abbie' AND patients.last = 'Cole' AND claims.billableperiod BETWEEN '2010-12-31' AND '2012-01-01'
Database: synthea
Note: allergies refer to patient from allergies;
Question: How many allergies does Mrs. Saundra Monahan have?
SQL: SELECT count(DISTINCT allergies.code) FROM patients INNER JOIN allergies ON patients.patient = allergies.patient WHERE patients.prefix = 'Mrs.' AND patients.first = 'Saundra' AND patients.last = 'Monahan'
Database: synthea
Note: name of the patient implies full name and refers to first, last; on 1947/9/11 refers to billableperiod = '1947-09-11';
Question: Provide the name of the patient who had a claim on 1947/9/11.
SQL: SELECT patients.first, patients.last FROM patients INNER JOIN claims ON patients.patient = claims.patient WHERE claims.billableperiod = '1947-09-11'
Database: synthea
Note: encounter refers to description from encounters; on 2008/10/25 refers to date = '2008-10-25';
Question: Describe the encounter of Mr. Hubert Baumbach on 2008/10/25.
SQL: SELECT encounters.description FROM patients INNER JOIN encounters ON patients.patient = encounters.patient WHERE patients.prefix = 'Mr.' AND patients.first = 'Hubert' AND patients.last = 'Baumbach' AND encounters.date = '2008-10-25'
Database: synthea
Note: 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';
Question: What kind of condition did Keven Kuhn have from 2016/9/24 to 2016/10/10? Describe the condition.
SQL: SELECT conditions.description FROM patients INNER JOIN conditions ON patients.patient = conditions.patient WHERE patients.first = 'Keven' AND patients.last = 'Kuhn' AND conditions.start = '2016-09-24' AND conditions.stop = '2016-10-10'
Database: synthea
Note: standard pregnancy test refers to description = 'Standard pregnancy test' from procedures;
Question: When did Mrs. Ira Deckow have the standard pregnancy test?
SQL: SELECT procedures.date FROM patients INNER JOIN procedures ON patients.patient = procedures.patient WHERE patients.prefix = 'Mrs.' AND patients.first = 'Ira' AND patients.last = 'Deckow' AND procedures.description = 'Standard pregnancy test'
Database: synthea
Note: DIVidE(SUBTRACT(stop time - start time), COUNT(id)));
Question: Calculate the average period of Mr. Wesley Lemke's care plans.
SQL: SELECT cast(sum(strftime('%J', careplans.stop) - strftime('%J', careplans.start)) AS REAL) / count(patients.patient) FROM patients INNER JOIN careplans ON patients.patient = careplans.patient WHERE patients.prefix = 'Mr.' AND patients.first = 'Wesley' AND patients.last = 'Lemke'
Database: synthea
Note: DIVidE(SUBTRACT(stop time - start time), COUNT(description = 'Normal pregnancy')));
Question: State the average period of Ms. Angelena Kertzmann's several normal pregnancies.
SQL: SELECT cast(sum(strftime('%J', conditions.stop) - strftime('%J', conditions.start)) AS REAL) / count(conditions.patient) FROM patients INNER JOIN conditions ON patients.patient = conditions.patient WHERE patients.prefix = 'Ms.' AND patients.first = 'Angelena' AND patients.last = 'Kertzmann' AND conditions.description = 'Normal pregnancy'
Database: synthea
Note: 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)));
Question: What is the id of the patient who has the longest allergy period?
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
Note: diabetes that started in 1988 refers to description = 'Diabetes' from conditions and start like '1988%';
Question: How many patients have diabetes that started in 1988?
SQL: SELECT count(patient) FROM conditions WHERE description = 'Diabetes' AND strftime('%Y', START) = '1988'
Database: synthea
Note: allergic to eggs refer to description = 'Allergy to eggs' from allergies;
Question: How many patients are allergic to eggs?
SQL: SELECT count(patient) FROM allergies WHERE description = 'Allergy to eggs'
Database: synthea
Note: id of the patient refers to patient from conditions;  hypertension refers to description = 'Hypertension'; most recently refers to MAX(start);
Question: What is the id of the patient whose hypertension started most recently?
SQL: SELECT patient FROM conditions WHERE START = ( SELECT max(START) FROM conditions WHERE description = 'Hypertension' )
Database: synthea
Note: the most common allergy refers to MAX(COUNT(description)) from allergies;
Question: What is the most common allergy among patients?
SQL: SELECT description FROM allergies GROUP BY description ORDER BY count(description) DESC LIMIT 1
Database: synthea
Note: id of the tallest patient/s refers to patient from observations where MAX(description = 'Body Height');
Question: What is/are the ids of the tallest patient/s?
SQL: SELECT patient FROM observations WHERE description = 'Body Height' AND units = 'cm' ORDER BY value DESC LIMIT 1
Database: synthea
Note: the most common condition refers to MAX(COUNT(description)); among the female Americans refer to patient where gender = 'F' and ethnicity = 'american';
Question: What is the most common condition among the female Americans?
SQL: SELECT conditions.description FROM patients INNER JOIN conditions ON patients.patient = conditions.patient WHERE patients.gender = 'F' AND patients.ethnicity = 'american' GROUP BY conditions.description ORDER BY count(conditions.description) DESC LIMIT 1
Database: synthea
Note: 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;
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?
SQL: SELECT count(DISTINCT patients.patient) FROM patients INNER JOIN medications ON patients.patient = medications.patient WHERE medications.description = 'Ibuprofen 200 MG Oral Tablet' AND patients.ethnicity = 'dominican' AND strftime('%Y', medications.start) = '2016' AND strftime('%m', medications.stop) - strftime('%m', medications.start) = 1
Database: synthea
Note: patients born in 1920s refer to patient where birthdate like '192%'; pneumonia refers to description = 'Pneumonia' from conditions;
Question: How many of the patients born in 1920s had pneumonia?
SQL: SELECT count(DISTINCT patients.patient) FROM patients INNER JOIN conditions ON patients.patient = conditions.patient WHERE description = 'Pneumonia' AND strftime('%Y', patients.birthdate) LIKE '192%'
Database: synthea
Note: 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%';
Question: What are the full names of the patients who started taking Yaz 28 Day Pack in 2011?
SQL: SELECT DISTINCT patients.first, patients.last, patients.suffix FROM patients INNER JOIN medications ON patients.patient = medications.patient WHERE medications.description = 'Yaz 28 Day Pack' AND strftime('%Y', medications.start) = '2011'
Database: synthea
Note: Black patients refer to patient where race = 'black'; immunized with DTaP refers to description = 'DTaP' from immunizations; in 2013 refers to date like '2013%';
Question: How many Black patients were immunized with DTaP in 2013?
SQL: SELECT count(DISTINCT patients.patient) FROM patients INNER JOIN immunizations ON patients.patient = immunizations.patient WHERE patients.race = 'black' AND immunizations.description = 'DTaP' AND strftime('%Y', immunizations.date) = '2013'
Database: synthea
Note: patient with the most prevalent condition refers to patient where MAX(prevalence rate); started recently refers to MAX(start);
Question: How many immunizations did the patient with the most prevalent condition that started recently get?
SQL: SELECT count(conditions.patient) FROM all_prevalences INNER JOIN conditions ON lower(all_prevalences.item) = lower(conditions.description) INNER JOIN immunizations ON conditions.patient = immunizations.patient GROUP BY conditions.patient ORDER BY conditions.start DESC, all_prevalences."PREVALENCE RATE" DESC LIMIT 1
Database: synthea
Note: the most prevalent conditions refer to MAX(prevalence rate);
Question: How many patients have the most prevalent conditions?
SQL: SELECT count(DISTINCT conditions.patient) FROM all_prevalences INNER JOIN conditions ON lower(all_prevalences.item) = lower(conditions.description) ORDER BY all_prevalences."PREVALENCE RATE" DESC LIMIT 1
Database: synthea
Note: 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;
Question: What is the most common condition among the patients who received influenza seasonal injectable preservative free immunization?
SQL: SELECT conditions.description FROM immunizations INNER JOIN conditions ON immunizations.patient = conditions.patient WHERE immunizations.description = 'Influenza  seasonal  injectable  preservative free' GROUP BY conditions.description ORDER BY count(conditions.description) DESC LIMIT 1
Database: synthea
Note: ids of the patients refer to patient from conditions; condition that has a prevalence percentage of 18.8% refers to prevalence percentage = 18.8;
Question: List the ids of all the patients with condition that has a prevalence percentage of 18.8%.
SQL: SELECT DISTINCT conditions.patient FROM conditions INNER JOIN all_prevalences ON lower(all_prevalences.item) = lower(conditions.description) WHERE all_prevalences."PREVALENCE PERCENTAGE" = cast(18.8 AS float)
Database: synthea
Note: conditions refer to description from conditions;
Question: How many conditions did Tyree Eichmann have?
SQL: SELECT count(DISTINCT conditions.description) FROM patients INNER JOIN conditions ON patients.patient = conditions.patient WHERE patients.first = 'Tyree' AND patients.last = 'Eichmann'
Database: synthea
Note: immunized with meningococcal MCV4P refers to description = 'meningococcal MCV4P' from immunizations; viral sinusitis disorder refers to description = 'Viral sinusitis (disorder)' from conditions;
Question: Among the patients who were immunized with meningococcal MCV4P, how many have viral sinusitis disorder after getting the immunization?
SQL: SELECT count(DISTINCT immunizations.patient) FROM immunizations INNER JOIN conditions ON immunizations.patient = conditions.patient WHERE immunizations.description = 'meningococcal MCV4P' AND conditions.description = 'Viral sinusitis (disorder)'
Database: synthea
Note: patients with prediabetes refer to patient from conditions where description = 'Prediabetes'; female refers to gender = 'F';
Question: Among the patients with prediabetes, how many are female?
SQL: SELECT count(DISTINCT patients.patient) FROM conditions INNER JOIN patients ON conditions.patient = patients.patient WHERE patients.gender = 'F' AND conditions.description = 'Prediabetes'
Database: synthea
Note: 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';
Question: Indicate the patient's full name with the lowest body mass index in kg/m2.
SQL: SELECT patients.first, patients.last FROM patients INNER JOIN observations ON patients.patient = observations.patient WHERE observations.description = 'Body Mass Index' AND observations.units = 'kg/m2' ORDER BY observations.value LIMIT 1
Database: synthea
Note: age refers to SUBTRACT(strftime('%Y', deathdate), strftime('%Y', birthdate)); hypertension refers to conditions where description = 'Hypertension';
Question: What is the age of the patient with hypertension named Giovanni Russel?
SQL: SELECT strftime('%Y', patients.deathdate) - strftime('%Y', patients.birthdate) AS age FROM conditions INNER JOIN patients ON conditions.patient = patients.patient WHERE patients.first = 'Giovanni' AND patients.last = 'Russel' AND conditions.description = 'Hypertension'
Database: synthea
Note: female refers to gender = 'F'; oxaliplatin 5 MG/ML [Eloxatin] refers to medications where description = 'oxaliplatin 5 MG/ML [Eloxatin]';
Question: How many Asian female patients take oxaliplatin 5 MG/ML [Eloxatin]?
SQL: SELECT count(DISTINCT patients.patient) FROM medications INNER JOIN patients ON medications.patient = patients.patient WHERE medications.description = 'oxaliplatin 5 MG/ML [Eloxatin]' AND patients.race = 'asian' AND patients.gender = 'F'
Database: synthea
Note: if deathdate is null, it means this patient is still alive or living; stroke refers to conditions where description = 'Stroke';
Question: Count all of the living patients that had a stroke.
SQL: SELECT count(DISTINCT patients.patient) FROM conditions INNER JOIN patients ON conditions.patient = patients.patient WHERE conditions.description = 'Stroke' AND patients.deathdate IS NULL
Database: synthea
Note: Asian refers to race like 'asian%'; allergic to peanuts refers to allergies where description = 'Allergy to peanuts';
Question: What is the total number of Asian patients who are allergic to peanuts?
SQL: SELECT count(patients.patient) FROM allergies INNER JOIN patients ON allergies.patient = patients.patient WHERE allergies.description = 'Allergy to peanuts' AND patients.race = 'asian'
Database: synthea
Note: hypertension refers to conditions where description = 'Hypertension'; average diastolic blood pressure refers to AVG(value) where description = 'Diastolic Blood Pressure' from observations;
Question: Among the patients with hypertension, what is the average of their diastolic blood pressure?
SQL: SELECT avg(observations.value) FROM observations INNER JOIN patients ON observations.patient = patients.patient INNER JOIN conditions ON patients.patient = conditions.patient WHERE conditions.description = 'Hypertension' AND observations.description = 'Diastolic Blood Pressure'
Database: synthea
Note: medicine prescribed refers to description from medications; social security number 999-94-3751 refers to ssn = '999-94-3751';
Question: What is the medicine prescribed for the patient with social security number 999-94-3751?
SQL: SELECT medications.description FROM medications INNER JOIN patients ON medications.patient = patients.patient WHERE patients.ssn = '999-94-3751'
Database: synthea
Note: 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';
Question: Give the social security number of the female Irish patient allergic to grass pollen.
SQL: SELECT patients.ssn FROM allergies INNER JOIN patients ON allergies.patient = patients.patient WHERE allergies.description = 'Allergy to grass pollen' AND patients.ethnicity = 'irish' AND patients.gender = 'F'
Database: synthea
Question: Who is the patient involved in the care plan with code 311791003?
SQL: SELECT patients.first, patients.last FROM careplans INNER JOIN patients ON careplans.patient = patients.patient WHERE careplans.code = 315043002
Database: synthea
Note: 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)));
Question: Among the patients that died, what is the condition of the oldest patient?
SQL: SELECT conditions.description FROM conditions INNER JOIN patients ON conditions.patient = patients.patient WHERE patients.deathdate IS NOT NULL ORDER BY strftime('%Y', patients.deathdate) - strftime('%Y', patients.birthdate) DESC LIMIT 1
Database: synthea
Question: What is the code of the prevalent disease with the highest occurrences?
SQL: SELECT conditions.code FROM all_prevalences INNER JOIN conditions ON all_prevalences.item = conditions.description ORDER BY all_prevalences.occurrences DESC LIMIT 1
Database: synthea
Note: 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';
Question: What is the glucose level of the patient that lives at 365 Della Crossroad Suite 202, Deerfield, MA 01342 US?
SQL: SELECT DISTINCT observations.description, observations.value, observations.units FROM patients INNER JOIN observations ON patients.patient = observations.patient WHERE observations.description = 'Glucose' AND patients.address = '365 Della Crossroad Suite 202 Deerfield MA 01342 US'
Database: synthea
Note: social security number refers to ssn; prevalence percentage lower than 30% of the average prevalence percentage of conditions refers to prevalence percentage < MULTIPLY(0.3, AVG(prevalence percentage));
Question: Provide at least 5 social security numbers of patients with a prevalent disease with a prevalence percentage lower than 30% of the average prevalence percentage of conditions.
SQL: SELECT DISTINCT patients.ssn FROM conditions INNER JOIN patients ON conditions.patient = patients.patient INNER JOIN all_prevalences ON lower(conditions.description) = lower(all_prevalences.item) WHERE cast(all_prevalences."PREVALENCE PERCENTAGE" AS REAL) * 100 / ( SELECT avg('PREVALENCE PERCENTAGE') FROM all_prevalences ) < 30 LIMIT 5
Database: synthea
Note: DIVidE(COUNT(patient where gender = 'F' and race = 'asian'), COUNT(patient)) as percentage where description = 'Acute bronchitis (disorder)' ;
Question: Among the patients with acute bronchitis, what is the percentage of Asian women?
SQL: SELECT cast(sum(CASE WHEN patients.gender = 'F' AND patients.race = 'asian' THEN 1 ELSE 0 END) AS REAL) * 100 / count(patients.gender) FROM conditions INNER JOIN patients ON conditions.patient = patients.patient WHERE conditions.description = 'Acute bronchitis (disorder)'
Database: synthea
Question: Provide the number of encounters for Major D'Amore.
SQL: SELECT count(encounters.id) FROM patients INNER JOIN encounters ON patients.patient = encounters.patient WHERE patients.first = 'Major' AND patients.last = 'D''Amore'
Database: synthea
Note: procedures refer to description from procedures;
Question: List the procedures received by Emmy Waelchi.
SQL: SELECT procedures.description FROM patients INNER JOIN procedures ON patients.patient = procedures.patient WHERE patients.first = 'Emmy' AND patients.last = 'Waelchi'
Database: synthea
Note: patient's full name refers to first, last; extraction of wisdom tooth refers to description = 'Extraction of wisdom tooth' from procedures;
Question: Provide the patients' full names who received the extraction of wisdom tooth.
SQL: SELECT patients.first, patients.last FROM patients INNER JOIN procedures ON patients.patient = procedures.patient WHERE procedures.description = 'Extraction of wisdom tooth'
Database: synthea
Note: body weight value and units where description = 'Body Weight' from observations;
Question: Provide the body weight of Elly Koss in every observation.
SQL: SELECT observations.description, observations.value, observations.units FROM patients INNER JOIN observations ON patients.patient = observations.patient WHERE patients.first = 'Elly' AND patients.last = 'Koss' AND observations.description = 'Body Weight'
Database: synthea
Note: allergy to soy refers to allergies where description = 'Allergy to soya';
Question: Name the patients who had an allergy to soy.
SQL: SELECT patients.first, patients.last FROM patients INNER JOIN allergies ON patients.patient = allergies.patient WHERE allergies.description = 'Allergy to soya'
Database: synthea
Note: DTaP immunization refers to immunizations where description = 'DTaP';
Question: How many times did Keven Kuhn receive DTaP immunization?
SQL: SELECT count(immunizations.code) FROM patients INNER JOIN immunizations ON patients.patient = immunizations.patient WHERE patients.first = 'Keven' AND patients.last = 'Kuhn' AND immunizations.description = 'DTaP'
Database: synthea
Note: Who implies the full name of the patient which refers to first, last; Clopidogrel 75 MG Oral Tablet refers to medications where description = 'Clopidogrel 75 MG Oral Tablet'; for over 10 years refers to SUBTRACT(strftime('%Y', stop), strftime('%Y', start)) > 10;
Question: Who had to take Clopidogrel 75 MG Oral Tablet for over 10 years?
SQL: SELECT patients.first, patients.last FROM patients INNER JOIN medications ON patients.patient = medications.patient WHERE medications.description = 'Clopidogrel 75 MG Oral Tablet' AND strftime('%Y', medications.stop) - strftime('%Y', medications.start) > 10
Database: synthea
Note: procedures refer to description from procedures; medications refers to description from medications; third-degree burn refers to conditions where description = 'Third degree burn';
Question: Which procedures and medications were received by the patient with the third-degree burn?
SQL: SELECT DISTINCT procedures.description, medications.description FROM procedures INNER JOIN conditions ON procedures.patient = conditions.patient INNER JOIN medications ON conditions.patient = medications.patient WHERE conditions.description = 'Third degree burn'
Database: synthea
Note: medications refers to description from medications; allergy to mould refers to allergies where description = 'Allergy to mould'; on 6th June 2016 refers to start = '6/6/16';
Question: Provide medications received by patients with an allergy to mould on 6th June 2016.
SQL: SELECT medications.description FROM allergies INNER JOIN medications ON allergies.patient = medications.patient WHERE allergies.start = '6/6/16' AND allergies.description = 'Allergy to mould'