input stringlengths 1.31k 1.62k | output stringlengths 54 483 |
|---|---|
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. how many patients born before the year 2167 were primarily diagnosed for hyperglycemia? Here are the relevant SQL tables:
CREATE TABLE lab (
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "HYPERGLYCEMIA" AND demographic.dob_year < "2167" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. provide the number of patients whose diagnoses short title is anxiety state nos and drug route is oral? Here are the relevant SQL tables:
CRE... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Anxiety state NOS" AND prescriptions.route = "ORAL" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. give me the number of patients whose gender is f and primary disease is gastrointestinal bleed? Here are the relevant SQL tables:
CREATE TABL... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.diagnosis = "GASTROINTESTINAL BLEED" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. how many patients with hx traumatic fracture had a lab test for joint fluid? Here are the relevant SQL tables:
CREATE TABLE prescriptions (
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Hx traumatic fracture" AND lab.fluid = "Joint Fluid" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is the number of patients whose primary disease is s/p hanging and admission year is less than 2133? Here are the relevant SQL tables:
C... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "S/P HANGING" AND demographic.admityear < "2133" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is the number of patients whose marital status is single? Here are the relevant SQL tables:
CREATE TABLE prescriptions (
subject_id ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "SINGLE" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is the number of patients whose year of birth is less than 2043 and lab test fluid is urine? Here are the relevant SQL tables:
CREATE TA... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2043" AND lab.fluid = "Urine" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is the number of patients prescribed sulfameth/trimethoprim ds who were admitted via physician referral/normal delivery? Here are the re... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND prescriptions.drug = "Sulfameth/Trimethoprim DS" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. give me the number of patients whose diagnoses icd9 code is 42831 and lab test fluid is other body fluid? Here are the relevant SQL tables:
C... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.icd9_code = "42831" AND lab.fluid = "Other Body Fluid" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. find the number of patients born before 2156 who had endoscopic retrograde cholangiography. Here are the relevant SQL tables:
CREATE TABLE de... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dob_year < "2156" AND procedures.short_title = "Endosc retro cholangiopa" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. How many patients stayed in hospital for more than 27 days and got diagnosed for intermed coronary synd? Here are the relevant SQL tables:
CR... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "27" AND diagnoses.short_title = "Intermed coronary synd" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. how many patients are diagnosed for atherosclerosis of native arteries of the extremities with intermittent claudication and had lab test abn... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Atherosclerosis of native arteries of the extremities with intermittent claudication" AND lab.flag = "abnormal" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. provide the number of patients whose gender is f and days of hospital stay is greater than 16? Here are the relevant SQL tables:
CREATE TABLE... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.days_stay > "16" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is procedure icd9 code and procedure long title of subject name jonathan wiggins? Here are the relevant SQL tables:
CREATE TABLE diagnos... | SELECT procedures.icd9_code, procedures.long_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.name = "Jonathan Wiggins" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. count the number of patients whose admission type is newborn and days of hospital stay is greater than 8? Here are the relevant SQL tables:
C... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "NEWBORN" AND demographic.days_stay > "8" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. how many patients whose admission location is trsf within this facility and procedure icd9 code is 8857? Here are the relevant SQL tables:
CR... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND procedures.icd9_code = "8857" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. give the number of patients diagnosed under icd9 code 7245 whose lab test status is delta. Here are the relevant SQL tables:
CREATE TABLE dem... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.icd9_code = "7245" AND lab.flag = "delta" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is the drug route for drug ciprobase? Here are the relevant SQL tables:
CREATE TABLE procedures (
subject_id text,
hadm_id text,... | SELECT prescriptions.route FROM prescriptions WHERE prescriptions.formulary_drug_cd = "CIPROBASE" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. give me the number of patients whose procedure long title is radical neck dissection, unilateral and lab test category is blood gas? Here are... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE procedures.long_title = "Radical neck dissection, unilateral" AND lab."CATEGORY" = "Blood Gas" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is the number of patients whose admission type is urgent and with lab test item id 50980? Here are the relevant SQL tables:
CREATE TABLE... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "URGENT" AND lab.itemid = "50980" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. tell me the number of medicaid insurance patients who had procedure icd9 code 4432. Here are the relevant SQL tables:
CREATE TABLE procedures... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Medicaid" AND procedures.icd9_code = "4432" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. find the maximum age of patients whose admission location is emergency room and primary disease is copd exacerbation. Here are the relevant S... | SELECT MAX(demographic.age) FROM demographic WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND demographic.diagnosis = "COPD EXACERBATION" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. Find the route of administration for medication with a GELCLAIR drug code. Here are the relevant SQL tables:
CREATE TABLE procedures (
su... | SELECT prescriptions.route FROM prescriptions WHERE prescriptions.formulary_drug_cd = "GELCLAIR" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. give the number of patients whose insurance is government and lab test name is hematocrit, other fluid. Here are the relevant SQL tables:
CRE... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.insurance = "Government" AND lab.label = "Hematocrit, Other Fluid" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. how many patients whose diagnoses short title is dmii oth uncntrld? Here are the relevant SQL tables:
CREATE TABLE demographic (
subject_... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.short_title = "DMII oth uncntrld" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. provide me the number of patients with a diagnoses icd9 code 2809 who are younger than 31 years of age. Here are the relevant SQL tables:
CRE... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "31" AND diagnoses.icd9_code = "2809" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. how many patients whose insurance is medicare and diagnoses icd9 code is 3019? Here are the relevant SQL tables:
CREATE TABLE procedures (
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Medicare" AND diagnoses.icd9_code = "3019" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. provide the number of patients whose insurance is medicare and diagnoses short title is neutropenia nos? Here are the relevant SQL tables:
CR... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Medicare" AND diagnoses.short_title = "Neutropenia NOS" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. find the number of urgent hospital admission patients before the year 2194. Here are the relevant SQL tables:
CREATE TABLE procedures (
s... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "URGENT" AND demographic.admityear < "2194" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. How many patients discharge location is snf and were diagnosed with the primary disease upper gi bleed? Here are the relevant SQL tables:
CRE... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "SNF" AND demographic.diagnosis = "UPPER GI BLEED" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. How many patients aged below 79 years have lab test fluid as urine? Here are the relevant SQL tables:
CREATE TABLE prescriptions (
subjec... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "79" AND lab.fluid = "Urine" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. give me the number of patients whose diagnoses short title is routine circumcision and drug type is additive? Here are the relevant SQL table... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Routine circumcision" AND prescriptions.drug_type = "ADDITIVE" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. count the number of patients whose language is cape and admission location is phys referral/normal deli? Here are the relevant SQL tables:
CR... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.language = "CAPE" AND demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. Give the number of patients whose primary disease is overdose and died in or before year 2168. Here are the relevant SQL tables:
CREATE TABLE... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "OVERDOSE" AND demographic.dod_year <= "2168.0" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. provide the number of patients whose year of birth is less than 2182 and drug route is inhalation? Here are the relevant SQL tables:
CREATE T... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "2182" AND prescriptions.route = "INHALATION" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. give me the number of patients whose age is less than 41 and lab test fluid is pleural? Here are the relevant SQL tables:
CREATE TABLE lab (
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "41" AND lab.fluid = "Pleural" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is the number of male patients with drug code bag? Here are the relevant SQL tables:
CREATE TABLE prescriptions (
subject_id text,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.gender = "M" AND prescriptions.formulary_drug_cd = "BAG" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is the number of patients whose admission year is less than 2182 and lab test fluid is blood? Here are the relevant SQL tables:
CREATE T... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2182" AND lab.fluid = "Blood" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. provide the number of patients whose admission location is clinic referral/premature and primary disease is sepsis? Here are the relevant SQL... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND demographic.diagnosis = "SEPSIS" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. give me the number of patients whose age is less than 62 and diagnoses short title is esophageal reflux? Here are the relevant SQL tables:
CR... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "62" AND diagnoses.short_title = "Esophageal reflux" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. how many patients have medicaid health insurance? Here are the relevant SQL tables:
CREATE TABLE diagnoses (
subject_id text,
hadm_id... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Medicaid" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. among patients admitted in the year less than 2203, how many of them were aged below 70? Here are the relevant SQL tables:
CREATE TABLE lab (... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.age < "70" AND demographic.admityear < "2203" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. find out the average age of patients whose marital status is single and ethnicity is hispanic/latino - puerto rican. Here are the relevant SQ... | SELECT AVG(demographic.age) FROM demographic WHERE demographic.marital_status = "SINGLE" AND demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. to which religious background does the patient with patient id 6983 belong to? Here are the relevant SQL tables:
CREATE TABLE prescriptions (... | SELECT demographic.religion FROM demographic WHERE demographic.subject_id = "6983" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. count the number of patients whose marital status is married and age is less than 31? Here are the relevant SQL tables:
CREATE TABLE demograp... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.age < "31" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. how many patients died in or before 2115? Here are the relevant SQL tables:
CREATE TABLE lab (
subject_id text,
hadm_id text,
ite... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.dod_year <= "2115.0" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. count the number of patients whose admission location is emergency room admit and age is less than 85? Here are the relevant SQL tables:
CREA... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND demographic.age < "85" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. how many asian patients have diagnoses icd9 code 30501? Here are the relevant SQL tables:
CREATE TABLE diagnoses (
subject_id text,
h... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "ASIAN" AND diagnoses.icd9_code = "30501" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is the number of office admission patients who have procedure icd9 code 4233? Here are the relevant SQL tables:
CREATE TABLE prescriptio... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND procedures.icd9_code = "4233" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. how many widow patients had transplant from cadaver? Here are the relevant SQL tables:
CREATE TABLE prescriptions (
subject_id text,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "WIDOWED" AND procedures.short_title = "Transplant cadaver donor" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. how many patients whose admission type is emergency and drug type is main? Here are the relevant SQL tables:
CREATE TABLE diagnoses (
sub... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND prescriptions.drug_type = "MAIN" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. How many patients categorized under a chemistry lab test are diagnosed with esophageal varices in diseases classified elsewhere (with bleedin... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Bleed esoph var oth dis" AND lab."CATEGORY" = "Chemistry" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what number of patients admitted before the year 2125 have lab test item id 51484? Here are the relevant SQL tables:
CREATE TABLE demographic... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2125" AND lab.itemid = "51484" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. count the number of patients whose admission type is elective and primary disease is coronary artery disease? Here are the relevant SQL table... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "ELECTIVE" AND demographic.diagnosis = "CORONARY ARTERY DISEASE" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. give the number of patients who have been transferred within this facility and have stayed in the hospital for more than 30 days. Here are th... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND demographic.days_stay > "30" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is the number of patients categorized under chemistry lab test who have diagnoses of unspecified procedure as the cause of abnormal reac... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Abn react-procedure NOS" AND lab."CATEGORY" = "Chemistry" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is the number of patients whose admission year is less than 2129 and item id is 50993? Here are the relevant SQL tables:
CREATE TABLE pr... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2129" AND lab.itemid = "50993" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. give the number of patients who were admitted before the year 2198 and undergone the procedure circumcision. Here are the relevant SQL tables... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2198" AND procedures.long_title = "Circumcision" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. How many patients admitted before the year 2164 had a test for PTT? Here are the relevant SQL tables:
CREATE TABLE diagnoses (
subject_id... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2146" AND lab.label = "PTT" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is admission time and discharge time of subject name tracy farmer? Here are the relevant SQL tables:
CREATE TABLE demographic (
subj... | SELECT demographic.admittime, demographic.dischtime FROM demographic WHERE demographic.name = "Tracy Farmer" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. count the number of patients whose diagnosis short title is pyelonephritis nos and lab test abnormal status is delta. Here are the relevant S... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Pyelonephritis NOS" AND lab.flag = "delta" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is the number of patients whose age is less than 31 and diagnoses icd9 code is 2809? Here are the relevant SQL tables:
CREATE TABLE lab ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "31" AND diagnoses.icd9_code = "2809" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. Find the number of patients who had biopsy of bone marrow that stayed in the hospital for more than 6 days. Here are the relevant SQL tables:... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "6" AND procedures.long_title = "Biopsy of bone marrow" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. count the number of black/cape verdean patients who have base type drug prescription. Here are the relevant SQL tables:
CREATE TABLE demograp... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND prescriptions.drug_type = "BASE" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. how many black/african american patients had the item id 51363? Here are the relevant SQL tables:
CREATE TABLE diagnoses (
subject_id tex... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.ethnicity = "BLACK/AFRICAN AMERICAN" AND lab.itemid = "51363" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. provide the number of patients with a diagnoses of personal history of other malignant neoplasm of rectum, rectosigmoid junction and anus and... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "0" AND diagnoses.short_title = "Hx-rectal & anal malign" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. among patients who remained admitted in hospital for more than 20 days, calculate the number of those on po therapy. Here are the relevant SQ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "20" AND prescriptions.route = "ORAL" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is admission time of subject id 6983? Here are the relevant SQL tables:
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
... | SELECT demographic.admittime FROM demographic WHERE demographic.subject_id = "6983" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. Specify the number of elective admissions before the year 2148 Here are the relevant SQL tables:
CREATE TABLE procedures (
subject_id tex... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "ELECTIVE" AND demographic.admityear < "2148" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. count the number of patients whose procedure icd9 code is 3799 and drug type is additive? Here are the relevant SQL tables:
CREATE TABLE pres... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE procedures.icd9_code = "3799" AND prescriptions.drug_type = "ADDITIVE" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is the icu stay id and drug code of subject id 65652? Here are the relevant SQL tables:
CREATE TABLE prescriptions (
subject_id text... | SELECT prescriptions.icustay_id, prescriptions.formulary_drug_cd FROM prescriptions WHERE prescriptions.subject_id = "65652" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is primary disease and procedure icd9 code of subject id 18077? Here are the relevant SQL tables:
CREATE TABLE procedures (
subject_... | SELECT demographic.diagnosis, procedures.icd9_code FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "18077" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. give me the number of patients whose ethnicity is black/cape verdean and age is less than 89? Here are the relevant SQL tables:
CREATE TABLE ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND demographic.age < "89" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. specify age and icd9 code of patient id 52118 Here are the relevant SQL tables:
CREATE TABLE demographic (
subject_id text,
hadm_id t... | SELECT demographic.age, procedures.long_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "52118" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. how many patients are diagnosed with the primary disease st elevated myocardial infarction or cardiac cath and procedured with icd9 code 7935... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "ST ELEVATED MYOCARDIAL INFARCTION\CARDIAC CATH" AND procedures.icd9_code = "7935" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. how many patients are with admission year before 2194 and with lab test item id 50817? Here are the relevant SQL tables:
CREATE TABLE diagnos... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2194" AND lab.itemid = "50817" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is the number of patients whose religion is protestant quaker and lab test name is thyroid stimulating hormone? Here are the relevant SQ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.religion = "PROTESTANT QUAKER" AND lab.label = "Thyroid Stimulating Hormone" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is average age of patients whose discharge location is disch-tran to psych hosp and primary disease is left femur fracture? Here are the... | SELECT AVG(demographic.age) FROM demographic WHERE demographic.discharge_location = "DISCH-TRAN TO PSYCH HOSP" AND demographic.diagnosis = "LEFT FEMUR FRACTURE" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is the number of patients whose insurance is private and procedure short title is ventricl shunt tube punc? Here are the relevant SQL ta... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Private" AND procedures.short_title = "Ventricl shunt tube punc" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is the number of patients whose diagnoses long title is incisional ventral hernia with obstruction? Here are the relevant SQL tables:
CR... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.long_title = "Incisional ventral hernia with obstruction" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is admission time and diagnoses long title of subject id 813? Here are the relevant SQL tables:
CREATE TABLE prescriptions (
subject... | SELECT demographic.admittime, diagnoses.long_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "813" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. how many patients are with medicaid insurance and diagnosed with retained plastic fragments? Here are the relevant SQL tables:
CREATE TABLE d... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Medicaid" AND diagnoses.long_title = "Retained plastic fragments" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. give me the number of patients whose diagnoses long title is diabetes with ketoacidosis, type i [juvenile type], not stated as uncontrolled a... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Diabetes with ketoacidosis, type I [juvenile type], not stated as uncontrolled" AND lab.flag = "abnormal" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is gender of subject id 17787? Here are the relevant SQL tables:
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid te... | SELECT demographic.gender FROM demographic WHERE demographic.subject_id = "17787" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is the number of patients whose hospital stay is above 0 days and underwent procedure intravenous infusion of clofarabine? Here are the ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "0" AND procedures.long_title = "Intravenous infusion of clofarabine" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. how many of the divorcee patients had icd9 code 8968? Here are the relevant SQL tables:
CREATE TABLE diagnoses (
subject_id text,
had... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "DIVORCED" AND procedures.icd9_code = "8968" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. specify the name of drug code lope2 Here are the relevant SQL tables:
CREATE TABLE procedures (
subject_id text,
hadm_id text,
ic... | SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.formulary_drug_cd = "LOPE2" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. Tell me the number of patients with bladder cancer/sda primary disease who died in or before 2173. Here are the relevant SQL tables:
CREATE T... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "BLADDER CANCER/SDA" AND demographic.dod_year <= "2173.0" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. provide the number of patients whose item id is 50915? Here are the relevant SQL tables:
CREATE TABLE prescriptions (
subject_id text,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "50915" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. Give me the number of patients diagnosed with chronic kidney disease nos and have drug route as sc. Here are the relevant SQL tables:
CREATE ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Chronic kidney dis NOS" AND prescriptions.route = "SC" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is the number of urgent hospital admission patients for whom joint fluid lab test was ordered? Here are the relevant SQL tables:
CREATE ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "URGENT" AND lab.fluid = "Joint Fluid" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. give me the number of patients whose diagnoses short title is b-complex defic nec and lab test abnormal status is abnormal? Here are the rele... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "B-complex defic NEC" AND lab.flag = "abnormal" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. count the number of patients whose insurance is medicare and diagnoses icd9 code is 41021? Here are the relevant SQL tables:
CREATE TABLE dia... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Medicare" AND diagnoses.icd9_code = "41021" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. Get me the number of white russian patients born before year 2103. Here are the relevant SQL tables:
CREATE TABLE prescriptions (
subject... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND demographic.dob_year < "2103" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is procedure long title of subject id 2560? Here are the relevant SQL tables:
CREATE TABLE procedures (
subject_id text,
hadm_id... | SELECT procedures.long_title FROM procedures WHERE procedures.subject_id = "2560" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is maximum age of patients whose insurance is private and discharge location is home health care? Here are the relevant SQL tables:
CREA... | SELECT MAX(demographic.age) FROM demographic WHERE demographic.insurance = "Private" AND demographic.discharge_location = "HOME HEALTH CARE" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. what is the number of patients whose days of hospital stay is greater than 20 and procedure icd9 code is 9907? Here are the relevant SQL tabl... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "20" AND procedures.icd9_code = "9907" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. Calculate the number of private insurance patients who have had other closed (endoscopic) biopsy of biliary duct or sphincter of oddi. Here a... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Private" AND procedures.long_title = "Other closed [endoscopic] biopsy of biliary duct or sphincter of Oddi" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. count the number of patients who have had transitional epithelial cells lab test. Here are the relevant SQL tables:
CREATE TABLE procedures (... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.label = "Transitional Epithelial Cells" |
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. give me the number of patients who underwent procedure with short tilte cardiac rhythm conv nec and were left against medical advice. Here ar... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "LEFT AGAINST MEDICAL ADVI" AND procedures.short_title = "Cardiac rhythm conv NEC" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.