problem
stringlengths
121
422
db_id
stringclasses
69 values
solution
stringlengths
23
804
Write SQL query to solve given problem: Who had to take Clopidogrel 75 MG Oral Tablet for over 10 years?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T1.first, T1.last FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Clopidogrel 75 MG Oral Tablet' AND strftime('%Y', T2.STOP) - strftime('%Y', T2.START) > 10
Write SQL query to solve given problem: Which procedures and medications were received by the patient with the third-degree burn?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T1.DESCRIPTION, T3.DESCRIPTION FROM procedures AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT INNER JOIN medications AS T3 ON T2.patient = T3.PATIENT WHERE T2.DESCRIPTION = 'Third degree burn'
Write SQL query to solve given problem: Provide medications received by patients with an allergy to mould on 6th June 2016.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T2.DESCRIPTION FROM allergies AS T1 INNER JOIN medications AS T2 ON T1.PATIENT = T2.PATIENT WHERE T1.START = '6/6/16' AND T1.DESCRIPTION = 'Allergy to mould'
Write SQL query to solve given problem: Describe the care plans received by the patient with secondary malignant neoplasm of the colon.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T1.DESCRIPTION FROM careplans AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Secondary malignant neoplasm of colon'
Write SQL query to solve given problem: What is the prevalence rate of the patients' diseases started on 9th May 2014?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T2."PREVALENCE RATE" FROM conditions AS T1 INNER JOIN all_prevalences AS T2 ON lower(T1.DESCRIPTION) = lower(T2.ITEM) WHERE T1.START = '2014-05-09'
Write SQL query to solve given problem: Among observations in 2011, provide the names and ages of patients whose Systolic Blood Pressures are 200mmHg.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T2.first, T2.last , CASE WHEN T2.deathdate IS NULL THEN strftime('%Y', T1.DATE) - strftime('%Y', T2.birthdate) ELSE strftime('%Y', T2.deathdate) - strftime('%Y', T2.birthdate) END AS age FROM observations AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'Systolic Blood Pressure' AND T1.VALUE = 200 AND T1.UNITS = 'mmHg' AND strftime('%Y', T1.DATE) = '2011'
Write SQL query to solve given problem: Among the immunizations in 2017, calculate the percentage of patients who received the Influenza seasonal injectable preservative free. Among them, how many patients are English?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT CAST(SUM(CASE WHEN T2.DESCRIPTION = 'Influenza seasonal injectable preservative free' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.patient), SUM(CASE WHEN T1.ethnicity = 'english' THEN 1 ELSE 0 END) FROM patients AS T1 INNER JOIN immunizations AS T2 ON T1.patient = T2.PATIENT WHERE strftime('%Y', T2.DATE) = '2017'
Write SQL query to solve given problem: List down the first name of patients who encountered normal pregnancy.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T1.first FROM patients AS T1 INNER JOIN encounters AS T2 ON T1.patient = T2.PATIENT WHERE T2.REASONDESCRIPTION = 'Normal pregnancy'
Write SQL query to solve given problem: What are the birth date of patients who took outpatient encounter care plan?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T1.birthdate FROM patients AS T1 INNER JOIN encounters AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Outpatient Encounter'
Write SQL query to solve given problem: List down the first name of patients who have cystitis condition.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T1.first FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Cystitis'
Write SQL query to solve given problem: How many stroke patients have married?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Stroke' AND T1.marital = 'M'
Write SQL query to solve given problem: List down the address of patients who have billable period in 2010.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T1.address FROM patients AS T1 INNER JOIN claims AS T2 ON T1.patient = T2.PATIENT WHERE T2.BILLABLEPERIOD LIKE '2010%'
Write SQL query to solve given problem: List down the last name of patients who are allergic to dairy products.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T1.last FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Allergy to dairy product'
Write SQL query to solve given problem: When the allergy starts for Angelo Buckridge.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T2.START FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Adolfo' AND T1.last = 'Schmitt' AND T2.STOP IS NOT NULL
Write SQL query to solve given problem: How many of the male patients are allergic to house dust mites?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'House dust mite allergy' AND T1.gender = 'M'
Write SQL query to solve given problem: What kind of allergy is most common among white people?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T2.DESCRIPTION FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT WHERE T1.race = 'white' GROUP BY T2.DESCRIPTION ORDER BY COUNT(T2.DESCRIPTION) DESC LIMIT 1
Write SQL query to solve given problem: List down the first name of patients who received "Influenza seasonal injectable preservative free" immunization.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T1.first, T1.last FROM patients AS T1 INNER JOIN immunizations AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Influenza seasonal injectable preservative free'
Write SQL query to solve given problem: Calculate the number of female patients who accepted "HPV quadrivalent" immunization.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN immunizations AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'HPV quadrivalent' AND T1.gender = 'F'
Write SQL query to solve given problem: List down the encounter descriptions of patients who were born in Pittsfield MA US.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T2.DESCRIPTION FROM patients AS T1 INNER JOIN encounters AS T2 ON T1.patient = T2.PATIENT WHERE T1.birthplace = 'Pittsfield MA US'
Write SQL query to solve given problem: Calculate the total type of allergies for German people.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(DISTINCT T2.DESCRIPTION) FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT WHERE T1.ethnicity = 'german'
Write SQL query to solve given problem: Calculate the average age of patients with prediabetes care plan.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT CAST(SUM(CASE WHEN T1.deathdate IS NULL THEN strftime('%Y', T2.STOP) - strftime('%Y', T1.birthdate) ELSE strftime('%Y', T1.deathdate) - strftime('%Y', T1.birthdate) END) AS REAL) / COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN careplans AS T2 ON T1.patient = T2.PATIENT WHERE T2.REASONDESCRIPTION = 'Prediabetes'
Write SQL query to solve given problem: How many of the patients who have stopped taking medication for 'coronary heart disease' are still alive?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(DISTINCT T2.patient) FROM medications AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.REASONDESCRIPTION = 'Coronary Heart Disease' AND T1.STOP IS NOT NULL AND T2.deathdate IS NULL
Write SQL query to solve given problem: How many of the patients who underwent a 'bone immobilization' procedure have a driver's license?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN procedures AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Bone immobilization' AND T1.drivers IS NOT NULL
Write SQL query to solve given problem: Indicate the full name of the patients who have 3 different allergies.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T1.first, T1.last FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT GROUP BY T1.patient ORDER BY COUNT(DISTINCT T2.DESCRIPTION) > 3
Write SQL query to solve given problem: How many patients with 'allergy to eggs' have been immunized with 'Td (adult) preservative free'?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(DISTINCT T2.patient) FROM allergies AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient INNER JOIN immunizations AS T3 ON T2.patient = T3.PATIENT WHERE T1.DESCRIPTION = 'Allergy to eggs' AND T3.DESCRIPTION = 'Td (adult) preservative free'
Write SQL query to solve given problem: How many patients with a body weight of more than 100 kg have a 'diabetes self-management plan' care plan?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(DISTINCT T2.patient) FROM careplans AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient INNER JOIN observations AS T3 ON T2.patient = T3.PATIENT WHERE T3.DESCRIPTION = 'Body Weight' AND T1.DESCRIPTION = 'Diabetes self management plan' AND T3.VALUE > 100 AND T3.UNITS = 'kg'
Write SQL query to solve given problem: What gender is more prone to 'dander (animal) allergy'?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T1.gender FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Dander (animal) allergy' GROUP BY T1.gender ORDER BY COUNT(T1.gender) DESC LIMIT 1
Write SQL query to solve given problem: On what dates did the billable period begin for patients with the last name Dickinson?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T2.BILLABLEPERIOD FROM patients AS T1 INNER JOIN claims AS T2 ON T1.patient = T2.PATIENT WHERE T1.last = 'Dickinson'
Write SQL query to solve given problem: List the full name of all patients with 'otitis media'.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T1.first, T1.last FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Otitis media'
Write SQL query to solve given problem: How many patients of Irish ethnicity take medication for 'myocardial infarction'?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T2.REASONDESCRIPTION = 'Myocardial Infarction' AND T1.ethnicity = 'irish'
Write SQL query to solve given problem: How many patients with care plan for 'concussion with loss of consciousness' are married?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN careplans AS T2 ON T1.patient = T2.PATIENT WHERE T1.marital = 'M' AND T2.REASONDESCRIPTION = 'Concussion with loss of consciousness'
Write SQL query to solve given problem: How many patients immunized against 'monovalent rotavirus' ceased their care plan on 11/23/2013?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(DISTINCT T1.patient) FROM careplans AS T1 INNER JOIN immunizations AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'rotavirus monovalent' AND T1.STOP = '2013-11-23'
Write SQL query to solve given problem: How many women need to take 'Nitroglycerin 0.4 MG/ACTUAT [Nitrolingual]'?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Nitroglycerin 0.4 MG/ACTUAT [Nitrolingual]' AND T1.gender = 'F'
Write SQL query to solve given problem: What percentage of patients born in 'Pembroke MA US' have 'allergy to grass pollen'?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT CAST(SUM(CASE WHEN T2.DESCRIPTION = 'Allergy to grass pollen' THEN 1 ELSE 0 END) AS REL) * 100 / COUNT(T1.patient) FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT WHERE T1.birthplace = 'Pembroke MA US'
Write SQL query to solve given problem: What is the average body weight of Asian patients?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT SUM(T2.VALUE) / COUNT(T1.patient) FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T1.race = 'asian' AND T2.DESCRIPTION = 'Body Weight' AND T2.UNITS = 'kg'
Write SQL query to solve given problem: Write down the Social Security numbers of patients who have latex allergies.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T1.ssn FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Latex allergy'
Write SQL query to solve given problem: How long did Isadora Moen's allergy last? Tell me what kind of allergy she has.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT CASE WHEN SUBSTR(T1.STOP, -2, 1) != '9' THEN SUBSTR(T1.STOP, LENGTH(T1.STOP) - 1) + 2000 END - CASE WHEN SUBSTR(T1.START, -2, 1) = '9' THEN SUBSTR(T1.START, LENGTH(T1.START) - 1) + 1900 ELSE SUBSTR(T1.START, LENGTH(T1.START) - 1) + 2000 END AS years , T1.DESCRIPTION FROM allergies AS T1 INNER JOIN patients AS T2 ON T2.patient = T1.PATIENT WHERE T1.STOP IS NOT NULL AND T1.START IS NOT NULL AND T2.first = 'Isadora' AND T2.last = 'Moen'
Write SQL query to solve given problem: How many times was Elly Koss given a care plan between 1/11/2009 and 10/23/2010?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(T2.PATIENT) FROM patients AS T1 INNER JOIN careplans AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.START BETWEEN '2009-01-11' AND '2010-10-23'
Write SQL query to solve given problem: In 2009, who among the married patients had undergone a care plan for more than 60 days?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T1.first, T1.last FROM patients AS T1 INNER JOIN careplans AS T2 ON T1.patient = T2.PATIENT WHERE T1.marital = 'M' AND strftime('%J', T2.STOP) - strftime('%J', T2.START) > 60
Write SQL query to solve given problem: Please provide the dates on which Elly Koss was immunized with the influenza seasonal injectable preservative-free vaccine.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T2.DATE FROM patients AS T1 INNER JOIN immunizations AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Influenza seasonal injectable preservative free' AND T1.first = 'Elly' AND T1.last = 'Koss'
Write SQL query to solve given problem: From 7/9/2010 to 10/29/2013, how many black patients were immunized with the meningococcal MCV4P vaccine?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN immunizations AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'meningococcal MCV4P' AND T2.DATE BETWEEN '2010-07-09' AND '2013-10-29' AND T1.race = 'black'
Write SQL query to solve given problem: Give me the immunization codes and dates on which Ms. Jacquelyn Shanahan was immunized with influenza seasonal injectable preservative-free vaccine.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T2.CODE, T2.DATE FROM patients AS T1 INNER JOIN immunizations AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Ms.' AND T1.first = 'Jacquelyn' AND T1.last = 'Shanahan' AND T2.DESCRIPTION = 'Influenza seasonal injectable preservative free'
Write SQL query to solve given problem: How long did Berry Keebler take the Acetaminophen 160 MG when he was admitted due to acute bronchitis?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT strftime('%J', T2.STOP) - strftime('%J', T2.START) AS takenDays FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Berry' AND T1.last = 'Keebler' AND T2.REASONDESCRIPTION = 'Acute bronchitis (disorder)' AND T2.DESCRIPTION = 'Acetaminophen 160 MG'
Write SQL query to solve given problem: In 2010, how many single patients took Nitrofurantoin 5 mg/ML [Furadantin] to cure cystitis?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T1.marital = 'S' AND T2.REASONDESCRIPTION = 'Cystitis' AND T2.DESCRIPTION = 'Nitrofurantoin 5 MG/ML [Furadantin]' AND strftime('%Y', T2.START) = '2010'
Write SQL query to solve given problem: Tell me the reason for Lavelle Vandervort's encounter on 11/20/2013?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T2.REASONDESCRIPTION FROM patients AS T1 INNER JOIN encounters AS T2 ON T1.patient = T2.PATIENT WHERE T2.DATE = '2013-11-20' AND T1.first = 'Lavelle' AND T1.last = 'Vandervort'
Write SQL query to solve given problem: From 1/9/2011 to 8/29/2012, how many German patients have their outpatient encounters?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN encounters AS T2 ON T1.patient = T2.PATIENT WHERE T1.ethnicity = 'german' AND T2.DATE BETWEEN '2011-01-09' AND '2012-08-29' AND T2.DESCRIPTION = 'Outpatient Encounter'
Write SQL query to solve given problem: What is the social security number and address of the patient who encountered viral sinusitis symptoms on 6/13/2008?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T1.ssn, T1.address FROM patients AS T1 INNER JOIN encounters AS T2 ON T1.patient = T2.PATIENT WHERE T2.DATE = '2008-06-13' AND T2.REASONDESCRIPTION = 'Viral sinusitis (disorder)' AND T2.DESCRIPTION = 'Encounter for symptom'
Write SQL query to solve given problem: Give me the reason, name of the drug, and duration of medication under encounter ID 23c293ec-dbae-4a22-896e-f12cf3c8bac3. Tell me if the patient is still alive.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T2.REASONDESCRIPTION, T2.DESCRIPTION , strftime('%J', T2.STOP) - strftime('%J', T2.START) AS days , CASE WHEN T1.deathdate IS NULL THEN 'alive' ELSE 'dead' END FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T2.ENCOUNTER = '23c293ec-dbae-4a22-896e-f12cf3c8bac3'
Write SQL query to solve given problem: How many patients with shellfish allergies died when they were under 12 years old? Please give their full names.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T1.first, T1.last FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Shellfish allergy' AND CAST((strftime('%J', T1.deathdate) - strftime('%J', T1.birthdate)) AS REAL) / 365 < 12
Write SQL query to solve given problem: How long was Mr. Major D'Amore prescribed with Amoxicillin 250 MG / Clavulanate 125 MG [Augmentin]?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
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 T2.DESCRIPTION = ' Amoxicillin 250 MG / Clavulanate 125 MG [Augmentin]' AND T1.first = 'Major' AND T1.last = 'D''Amore'
Write SQL query to solve given problem: How many types of medication have been prescribed to Mr. Major D'Amore since his visit to the hospital?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(DISTINCT T2.DESCRIPTION) FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Major' AND T1.last = 'D''Amore'
Write SQL query to solve given problem: List out all the observation information collected for the patient named Bella Rolfson.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T2.DESCRIPTION, T2.VALUE, T2.UNITS FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Bella' AND T1.last = 'Rolfson'
Write SQL query to solve given problem: List out patient names with calcium deficiency.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T1.first, T1.last FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Calcium' AND T2.VALUE < 8.6
Write SQL query to solve given problem: List out 5 most common conditions for underweight patient.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
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 = 'Body Mass Index' GROUP BY T2.VALUE ORDER BY COUNT(T2.VALUE) LIMIT 5
Write SQL query to solve given problem: How many mothers have taken immunization during prenatal visit?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(DISTINCT T2.PATIENT) FROM encounters AS T1 INNER JOIN immunizations AS T2 ON T1.PATIENT = T2.PATIENT WHERE T1.REASONDESCRIPTION = 'Normal pregnancy' AND T1.DATE = T2.DATE
Write SQL query to solve given problem: What care plans have been received by Mrs. Elly Koss during year 1970?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T2.DESCRIPTION FROM patients AS T1 INNER JOIN careplans AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND strftime('%Y', T2.START) = '2013'
Write SQL query to solve given problem: What is the care plan, procedure, medication and the patient's full name for encounter 6f2e3935-b203-493e-a9c0-f23e847b9798?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T3.DESCRIPTION, T4.DESCRIPTION, T5.DESCRIPTION, T1.first, T1.last FROM patients AS T1 INNER JOIN encounters AS T2 ON T1.patient = T2.PATIENT INNER JOIN careplans AS T3 ON T1.patient = T3.PATIENT INNER JOIN procedures AS T4 ON T1.patient = T4.PATIENT INNER JOIN medications AS T5 ON T1.patient = T5.PATIENT WHERE T2.ID = '6f2e3935-b203-493e-a9c0-f23e847b9798'
Write SQL query to solve given problem: How many male patients are diagnosed with hypertension as compared to female patients?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(DISTINCT CASE WHEN T2.gender = 'M' THEN T2.patient END) AS Male , COUNT(DISTINCT CASE WHEN T2.gender = 'F' THEN T2.patient END) AS Female FROM conditions AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'Hypertension'
Write SQL query to solve given problem: How many unmarried women were checked for normal pregnancy?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(DISTINCT T2.patient) FROM conditions AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'Normal pregnancy' AND T2.gender = 'F' AND T2.marital = 'S'
Write SQL query to solve given problem: List out the procedure and medicine prescribed for drug overdose patients.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T2.DESCRIPTION, T3.DESCRIPTION FROM encounters AS T1 INNER JOIN procedures AS T2 ON T1.PATIENT = T2.PATIENT INNER JOIN medications AS T3 ON T1.PATIENT = T3.PATIENT WHERE T1.REASONDESCRIPTION = 'Drug overdose'
Write SQL query to solve given problem: What is the average body mass index for patients with higher total cholesterol?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT SUM(T1.VALUE) / COUNT(T1.PATIENT) FROM observations AS T1 INNER JOIN ( SELECT DISTINCT PATIENT FROM observations WHERE DESCRIPTION = 'Total Cholesterol' AND VALUE > 200 ) AS T2 ON T1.PATIENT = T2.PATIENT WHERE T1.DESCRIPTION = 'Body Mass Index'
Write SQL query to solve given problem: What is the difference between average glucose reading for patients in the 20s and 50s?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT SUM(CASE WHEN ROUND((strftime('%J', T2.DATE) - strftime('%J', T1.birthdate)) / 365) BETWEEN 20 AND 30 THEN T2.VALUE ELSE 0 END) / COUNT(CASE WHEN ROUND((strftime('%J', T2.DATE) - strftime('%J', T1.birthdate)) / 365) BETWEEN 20 AND 30 THEN T2.PATIENT END) - SUM(CASE WHEN ROUND((strftime('%J', T2.DATE) - strftime('%J', T1.birthdate)) / 365) BETWEEN 50 AND 60 THEN T2.VALUE ELSE 0 END) / COUNT(CASE WHEN ROUND((strftime('%J', T2.DATE) - strftime('%J', T1.birthdate)) / 365) BETWEEN 50 AND 60 THEN T2.PATIENT END) AS difference FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Glucose'
Write SQL query to solve given problem: What is the percentage of the most common conditions for patients age 60 and above?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT CAST(SUM(CASE WHEN T5.DESCRIPTION = T3.DESCRIPTION THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T3.patient) FROM ( SELECT T2.DESCRIPTION, T1.patient FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE ROUND((strftime('%J', T2.START) - strftime('%J', T1.birthdate)) / 365) > 60 GROUP BY T2.DESCRIPTION ORDER BY COUNT(T2.DESCRIPTION) DESC LIMIT 1 ) AS T3 INNER JOIN patients AS T4 ON T3.patient = T4.patient INNER JOIN conditions AS T5 ON T4.patient = T5.PATIENT WHERE ROUND((strftime('%J', T5.START) - strftime('%J', T4.birthdate)) / 365) > 60
Write SQL query to solve given problem: Name the reason Walter Bahringer visited medical professionals in July 2009.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T2.REASONDESCRIPTION FROM patients AS T1 INNER JOIN encounters AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Walter' AND T1.last = 'Bahringer' AND T2.DATE LIKE '2009-07%'
Write SQL query to solve given problem: How old was Mr. Stacy Morar at the time of his first emergency room admission due to a drug overdose?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T2.DATE - T1.birthdate AS age FROM patients AS T1 INNER JOIN encounters AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Stacy' AND T1.last = 'Morar' AND T2.DESCRIPTION = 'Emergency Room Admission' AND T2.REASONDESCRIPTION = 'Drug overdose' ORDER BY T2.DATE LIMIT 1
Write SQL query to solve given problem: What drug is administered more often to treat child attention deficit disorder?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DESCRIPTION FROM medications WHERE REASONDESCRIPTION = 'Child attention deficit disorder' GROUP BY DESCRIPTION ORDER BY COUNT(DESCRIPTION) DESC LIMIT 1
Write SQL query to solve given problem: Please include the full name of the patient who received a lung transplant.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T2.first, T2.last FROM procedures AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'Transplant of lung (procedure)'
Write SQL query to solve given problem: How many patients on average receive combined chemotherapy and radiation therapy procedures each year?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT CAST(COUNT(PATIENT) AS REAL) / COUNT(DISTINCT strftime('%Y', DATE)) FROM procedures WHERE DESCRIPTION = 'Combined chemotherapy and radiation therapy (procedure)'
Write SQL query to solve given problem: Indicate the time frame and details of the most recent care plan suggested to Jacquelyn Shanahan.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT strftime('%J', T2.STOP) - strftime('%J', T2.START) AS timeFrame , T2.DESCRIPTION FROM patients AS T1 INNER JOIN careplans AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Jacquelyn' AND T1.last = 'Shanahan' ORDER BY T2.START DESC LIMIT 1
Write SQL query to solve given problem: Identify the allergy period for Isadora Moen and what triggered it.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T2.START, T2.STOP, T2.DESCRIPTION FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Isadora' AND T1.last = 'Moen'
Write SQL query to solve given problem: How old was Mrs. Laronda Bernier at the time of her most recent medical encounter?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T2.DATE - T1.birthdate AS age FROM patients AS T1 INNER JOIN encounters AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Laronda' AND T1.last = 'Bernier' ORDER BY T2.DATE DESC LIMIT 1
Write SQL query to solve given problem: What condition forced Mrs. Joye Homenick to seek medical attention in 2017?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T2.DESCRIPTION FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Joye' AND T1.last = 'Homenick' AND strftime('%Y', T2.START) = '2017'
Write SQL query to solve given problem: When did Mrs. Joye Homenick receive her most recent influenza seasonal vaccine?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T2.DATE FROM patients AS T1 INNER JOIN immunizations AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Influenza seasonal injectable preservative free' AND T1.first = 'Joye' AND T1.last = 'Homenick' ORDER BY T2.DATE DESC LIMIT 1
Write SQL query to solve given problem: How long did Elly Koss have to take Acetaminophen 160 MG?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
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 last = 'Koss' AND T2.DESCRIPTION = 'Acetaminophen 160 MG'
Write SQL query to solve given problem: How many patients sought medical attention due to a second-degree burn? Describe the care plan recommended to them.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(DISTINCT T2.PATIENT), T2.DESCRIPTION FROM encounters AS T1 INNER JOIN careplans AS T2 ON T1.PATIENT = T2.PATIENT WHERE T2.REASONDESCRIPTION = 'Second degree burn'
Write SQL query to solve given problem: Among all patients who sought medical attention in 2010 due to contact dermatitis, identify the percentage of females.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT CAST(SUM(CASE WHEN T2.gender = 'F' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.PATIENT) FROM encounters AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE strftime('%Y', T1.DATE) = '2010' AND T1.REASONDESCRIPTION = 'Contact dermatitis'
Write SQL query to solve given problem: How many interactions did Lorri Simons have with medical professionals between 2010 and 2017? What percentage of encounters are attributed to prenatal visits?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(T1.patient) , CAST(SUM(CASE WHEN T2.DESCRIPTION = 'Prenatal visit' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.patient) FROM patients AS T1 INNER JOIN encounters AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Lorri' AND T1.last = 'Simonis' AND strftime('%Y', T2.DATE) BETWEEN '2010' AND '2017'
Write SQL query to solve given problem: State description of medication taken by Joe Homenick.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T1.DESCRIPTION FROM medications AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T2.first = 'Joye' AND T2.last = 'Homenick'
Write SQL query to solve given problem: What is the start date of the care plan of the patient whose maiden name is Adams?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T1.START FROM careplans AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T2.maiden = 'Adams'
Write SQL query to solve given problem: Among the male patients, who has the earliest starting date of the care plan?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T2.first, T2.last FROM careplans AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T2.gender = 'M' ORDER BY T1.START LIMIT 1
Write SQL query to solve given problem: What is the percentage of Hispanic patients who stopped their care plan in 2011?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT CAST(SUM(CASE WHEN T2.race = 'hispanic' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.PATIENT) FROM careplans AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE strftime('%Y', T1.stop) = '2011'
Write SQL query to solve given problem: State the description of the reason why Angelo Buckridge needs the care plan.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T1.REASONDESCRIPTION FROM careplans AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T2.first = 'Angelo' AND T2.last = 'Buckridge'
Write SQL query to solve given problem: Mention the description of the care plan of American patients.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T1.DESCRIPTION FROM careplans AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T2.ethnicity = 'american'
Write SQL query to solve given problem: What are the medical encounter ids of patients who were born in Pembroke MA US?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T1.ENCOUNTER FROM careplans AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T2.birthplace = 'Pembroke MA US'
Write SQL query to solve given problem: List out the start date of the care plan of alive patients.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T1.START FROM careplans AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T2.deathdate IS NULL
Write SQL query to solve given problem: How many white patients have the reason code of 10509002?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(DISTINCT T1.PATIENT) FROM careplans AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T2.race = 'white' AND T1.REASONCODE = '10509002'
Write SQL query to solve given problem: List out full name of patients who have "Diabetic diet" in the description of the care plan.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T2.first, T2.last FROM careplans AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'Diabetic diet'
Write SQL query to solve given problem: List out the stop date of the care plan of dead patients.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T1.STOP FROM careplans AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T2.deathdate IS NOT NULL AND T1.STOP IS NOT NULL
Write SQL query to solve given problem: How many Italian patients have the care plan code of 304510005?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(DISTINCT T2.patient) FROM careplans AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T2.ethnicity = 'italian' AND T1.CODE = '304510005'
Write SQL query to solve given problem: What is the percentage of female patients who started the care plan in 2010?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT CAST(SUM(CASE WHEN T2.gender = 'F' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.PATIENT) AS percentage FROM careplans AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE strftime('%Y', T1.START) = '2010'
Write SQL query to solve given problem: How many black patients stopped their care plan in 2017?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(DISTINCT T2.patient) FROM careplans AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T2.race = 'black' AND strftime('%Y', T1.STOP) = '2017'
Write SQL query to solve given problem: How many male patients have prediabetes condition?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN conditions AS T2 WHERE T2.DESCRIPTION = 'Prediabetes' AND T1.gender = 'M'
Write SQL query to solve given problem: List the full names of patients with nut allergy.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T1.first, T1.last FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Allergy to nut'
Write SQL query to solve given problem: Describe the condition of patient Wilmer Koepp.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T2.DESCRIPTION FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Wilmer' AND T1.last = 'Koepp'
Write SQL query to solve given problem: Among the patients with viral sinusitis condition, which patient's gender is most affected? Provide the number for each respectively.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT SUM(CASE WHEN T1.gender = 'F' THEN 1 ELSE 0 END), SUM(CASE WHEN T1.gender = 'M' THEN 1 ELSE 0 END) FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Viral sinusitis (disorder)'
Write SQL query to solve given problem: Provide the full names of patients who have been taking Penicillin V Potassium 250 MG since 1948.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T1.first, T1.last FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Penicillin V Potassium 250 MG' AND strftime('%Y', T2.START) >= '1948'
Write SQL query to solve given problem: How many white patients whose birth year is 1935 have a stroke?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.patient WHERE strftime('%Y', T1.birthdate) = '1935' AND T1.race = 'white' AND T2.DESCRIPTION = 'Stroke'
Write SQL query to solve given problem: Which conditions the patient has when receiving the IPV immunization?. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T2.DESCRIPTION FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT INNER JOIN immunizations AS T3 ON T1.patient = T3.PATIENT WHERE T3.DESCRIPTION = 'IPV'
Write SQL query to solve given problem: List the patient ids whose disease has the most occurrences.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT T1.patient FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT INNER JOIN all_prevalences AS T3 ON T3.ITEM = T2.DESCRIPTION ORDER BY T3.OCCURRENCES DESC LIMIT 1
Write SQL query to solve given problem: List all the full names of patients with a condition described as cystitis.. Keep the solution inside sql tag ```sql [SQL-Query] ```
synthea
SELECT DISTINCT T1.first, T1.last FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.patient WHERE T2.DESCRIPTION = 'Cystitis'