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. what is the number of patients who have drug code vera120sr? Here are the relevant SQL tables:
CREATE TABLE diagnoses (
subject_id text,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.formulary_drug_cd = "VERA120SR" |
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 m and primary disease is guillain barre syndrome? Here are the relevant SQL tables:
CREATE TAB... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "M" AND demographic.diagnosis = "GUILLAIN BARRE SYNDROME" |
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 year is less than 2175 and diagnoses short title is chronic liver dis nec? Here are the releva... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2175" AND diagnoses.short_title = "Chronic liver dis NEC" |
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 ethnicity is hispanic/latino - puerto rican and drug type is base? Here are the relevant SQL tables:
CRE... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" 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. what is the number of patients whose age is less than 61 and lab test name is monocytes? Here are the relevant SQL tables:
CREATE TABLE proce... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "61" AND lab.label = "Monocytes" |
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 m and item id is 51148? Here are the relevant SQL tables:
CREATE TABLE prescriptions (
sub... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.gender = "M" AND lab.itemid = "51148" |
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 primary disease is overdose and lab test abnormal status is delta? Here are the relevant SQL tables:
CREATE TABLE dem... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "OVERDOSE" 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. how many patients are with admission location clinic referral/premature and discharged to snf? Here are the relevant SQL tables:
CREATE TABLE... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND demographic.discharge_location = "SNF" |
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 year of birth is less than 2103 and diagnoses short title is preterm nec 1250-1499g? Here are the relevant SQL tables... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dob_year < "2103" AND diagnoses.short_title = "Preterm NEC 1250-1499g" |
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 on nebulizer therapy, how many of them were widowed? Here are the relevant SQL tables:
CREATE TABLE procedures (
subject_i... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.marital_status = "WIDOWED" AND prescriptions.route = "NEB" |
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 primary disease is liver transplant and procedure short title is skin & subq dx proc nec? Here are the r... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "LIVER TRANSPLANT" AND procedures.short_title = "Skin & subq dx proc NEC" |
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 long title is ulcer of other part of foot and drug type is base? Here are the relevant SQL tables:
CREATE T... | 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.long_title = "Ulcer of other part of foot" 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. count the number of patients whose admission type is elective and lab test fluid is other body fluid? Here are the relevant SQL tables:
CREAT... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "ELECTIVE" 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. give me the number of married patients admitted in hospital before 2119. Here are the relevant SQL tables:
CREATE TABLE procedures (
subj... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.admityear < "2119" |
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 admission year is less than 2173 and lab test name is calculated bicarbonate, whole blood? Here are the ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2173" AND lab.label = "Calculated Bicarbonate, Whole 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. what is the number of patients whose days of hospital stay is greater than 27 and drug route is both eyes? Here are the relevant SQL tables:
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "27" AND prescriptions.route = "BOTH EYES" |
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 a government insurance policy? Here are the relevant SQL tables:
CREATE TABLE diagnoses (
subject_id text,
had... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Government" |
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 born before 2053 who are taking drug via ivpca route. Here are the relevant SQL tables:
CREATE TABLE procedures ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "2053" AND prescriptions.route = "IVPCA" |
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 dead patients who were diagnosed with unspecified pseudomonas infection? Here are the relevant SQL tables:
CREATE TABLE... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "1" AND diagnoses.short_title = "Pseudomonas infect 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. what is the number of patients whose diagnoses icd9 code is v667 and drug route is tp? Here are the relevant SQL tables:
CREATE TABLE demogra... | 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.icd9_code = "V667" AND prescriptions.route = "TP" |
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 emergency hospital admission patients have calculus of bile duct without mention of cholecystitis or obstruction diagnoses? Here are... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND diagnoses.long_title = "Calculus of bile duct without mention of cholecystitis, without mention of 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. How many patients who were diagnosed under icd9 code 481 have pb as drug route? Here are the relevant SQL tables:
CREATE TABLE demographic (
... | 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.icd9_code = "481" AND prescriptions.route = "PB" |
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 who stayed in the hospital for more than 27 days that had a magnesium lab test. Here are the relevant SQL t... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "27" AND lab.label = "Magnesium" |
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 procedure long title is combined right and left heart angiocardiography? Here are the relevant SQL table... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.long_title = "Combined right and left heart angiocardiography" |
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 number of divorced patients who were admitted before the year 2121. Here are the relevant SQL tables:
CREATE TABLE prescriptions... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "DIVORCED" AND demographic.admityear < "2121" |
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 ethnicity is asian and days of hospital stay is 23? Here are the relevant SQL tables:
CREATE TABLE lab ... | SELECT MAX(demographic.age) FROM demographic WHERE demographic.ethnicity = "ASIAN" AND demographic.days_stay = "23" |
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 patients on ih route of drug administration who have diagnoses of pneumonia, unspecified organism. Here are the relevant... | 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 = "Pneumonia, organism NOS" AND prescriptions.route = "IH" |
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 discharge time of subject id 3343? Here are the relevant SQL tables:
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
... | SELECT demographic.dischtime FROM demographic WHERE demographic.subject_id = "3343" |
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 minimum age of patients whose gender is f and primary disease is congestive heart failure? Here are the relevant SQL tables:
CREATE T... | SELECT MIN(demographic.age) FROM demographic WHERE demographic.gender = "F" AND demographic.diagnosis = "CONGESTIVE HEART FAILURE" |
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 70 and lab test fluid is cerebrospinal fluid (csf)? Here are the relevant SQL tables:
C... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "70" AND lab.fluid = "Cerebrospinal Fluid (CSF)" |
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 under the age of 71 underwent procedure under icd9 code 5732? Here are the relevant SQL tables:
CREATE TABLE prescriptions ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "71" AND procedures.icd9_code = "5732" |
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 before 2114, for how many of them have a death status unspecified? Here are the relevant SQL tables:
CREATE TABLE lab... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.expire_flag = "0" AND demographic.admityear < "2114" |
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 who had closed biopsy of bronchus? 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.admission_type = "URGENT" AND procedures.short_title = "Closed bronchial biopsy" |
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 drug type is additive and lab test name is calculated thyroxine (t4) index? Here are the relevant SQL ta... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.drug_type = "ADDITIVE" AND lab.label = "Calculated Thyroxine (T4) Index" |
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 admission time and procedure icd9 code for chandra schulman. Here are the relevant SQL tables:
CREATE TABLE lab (
subject_id ... | SELECT demographic.admittime, procedures.icd9_code FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.name = "Chandra Schulman" |
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 admission type is urgent and procedure icd9 code is 8968? Here are the relevant SQL tables:
CREATE TABLE la... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "URGENT" 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. how many widowed patients had the procedure extracorporeal circulation auxiliary to open heart surgery? Here are the relevant SQL tables:
CRE... | 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.long_title = "Extracorporeal circulation auxiliary to open heart surgery" |
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 year of death is less than or equal to 2111 and lab test fluid is pleural? Here are the relevant SQL tab... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dod_year <= "2111.0" 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 maximum age of patients whose insurance is private and days of hospital stay is 8? Here are the relevant SQL tables:
CREATE TABLE dia... | SELECT MAX(demographic.age) FROM demographic WHERE demographic.insurance = "Private" 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. what is the age and diagnosis icd9 code of subject id 2560? Here are the relevant SQL tables:
CREATE TABLE lab (
subject_id text,
had... | SELECT demographic.age, diagnoses.icd9_code FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.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 average age of patients whose admission location is phys referral/normal deli and primary disease is celo-vessicle fistula? Here are ... | SELECT AVG(demographic.age) FROM demographic WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND demographic.diagnosis = "CELO-VESSICLE FISTULA" |
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. Bring the list of patients with hyperglycemia (hyponatremia) as their primary disease who are discharged to snf. Here are the relevant SQL ta... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "SNF" AND demographic.diagnosis = "HYPERGLYCEMIA;HYPONATREMIA" |
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 days of hospital stay is greater than 14 and lab test name is bilirubin, direct? Here are the relevant S... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "14" AND lab.label = "Bilirubin, Direct" |
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 office admitted patients who had endoscopic retrograde cholangiopancreatography procedure. 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.admission_location = "CLINIC REFERRAL/PREMATURE" 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. give me the number of patients whose admission type is urgent and diagnoses long title is other preterm infants, 1,750-1,999 grams? Here are ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "URGENT" AND diagnoses.long_title = "Other preterm infants, 1,750-1,999 grams" |
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 maximum age of married patients who have an inpatient hospital discharge location. Here are the relevant SQL tables:
CREATE TAB... | SELECT MAX(demographic.age) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.discharge_location = "DISC-TRAN CANCER/CHLDRN H" |
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 divorced patients have lab test item id 50914? Here are the relevant SQL tables:
CREATE TABLE diagnoses (
subject_id text,
h... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "DIVORCED" AND lab.itemid = "50914" |
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 admitted before 2203 who had regional lymph node excision. Here are the relevant SQL tables:
CREATE TABLE l... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2203" AND procedures.long_title = "Regional lymph node excision" |
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 with hyperglycemia hyponatremia as their primary disease who have a 3783 procedure icd9 code. Here are the rel... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "HYPERGLYCEMIA;HYPONATREMIA" AND procedures.icd9_code = "3783" |
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 with gastrointestinal bleed primary disease who stayed in hospital for more than 14 days? Here are the relevan... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "GASTROINTESTINAL BLEED" AND demographic.days_stay > "14" |
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 female patients were treated with drug d10w? Here are the relevant SQL tables:
CREATE TABLE diagnoses (
subject_id text,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.gender = "F" AND prescriptions.drug = "D10W" |
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 were tested for rheumatoid factor and discharged to home? 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.discharge_location = "HOME" AND lab.label = "Rheumatoid Factor" |
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 subject name and death status of subject id 2560? Here are the relevant SQL tables:
CREATE TABLE demographic (
subject_id text,
... | SELECT demographic.name, demographic.expire_flag FROM demographic WHERE demographic.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. count the number of patients whose admission location is emergency room admit and diagnoses short title is mixed acid-base bal dis? Here are ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND diagnoses.short_title = "Mixed acid-base bal dis" |
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 born before the year 2152 who had procedure titled left heart cardiac cath. Here are the relevant SQL tables:
CRE... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dob_year < "2152" AND procedures.short_title = "Left heart cardiac cath" |
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 type and days of hospital stay of subject id 7273? Here are the relevant SQL tables:
CREATE TABLE lab (
subject_id text... | SELECT demographic.admission_type, demographic.days_stay FROM demographic WHERE demographic.subject_id = "7273" |
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 55 and drug code is warf1? Here are the relevant SQL tables:
CREATE TABLE diagnoses (
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "55" AND prescriptions.formulary_drug_cd = "WARF1" |
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 ethnicity is white and procedure short title is dx ultrasound-heart? Here are the relevant SQL tables:
C... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.ethnicity = "WHITE" AND procedures.short_title = "Dx ultrasound-heart" |
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 discharged to psychiatric facility-partial hospitalization who had a (aorto)coronary bypass of three coronary ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "DISCH-TRAN TO PSYCH HOSP" AND procedures.long_title = "(Aorto)coronary bypass of three coronary arteries" |
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 admitted before the year 2165 and diagnosed with hepatitis, unspecified. 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.admityear < "2165" AND diagnoses.long_title = "Hepatitis, unspecified" |
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 68 and lab test fluid is joint fluid? Here are the relevant SQL tables:
CREATE TABLE di... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "68" 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. how many patients whose diagnoses long title is diverticulosis of colon with hemorrhage and lab test fluid is blood? Here are the relevant SQ... | 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 = "Diverticulosis of colon with hemorrhage" 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. Calculate the total number of portuguese speaking patients. Here are the relevant SQL tables:
CREATE TABLE procedures (
subject_id text,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.language = "PORT" |
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 type of admission and discharge time of patient id 42820 Here are the relevant SQL tables:
CREATE TABLE procedures (
subject_id t... | SELECT demographic.admission_type, demographic.dischtime FROM demographic WHERE demographic.subject_id = "42820" |
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 days of hospital stay is greater than 69 and drug code is metr500? Here are the relevant SQL tables:
CRE... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "69" AND prescriptions.formulary_drug_cd = "METR500" |
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 average age of patients whose marital status is married and discharge location is snf? Here are the relevant SQL tables:
CREATE T... | SELECT AVG(demographic.age) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.discharge_location = "SNF" |
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 total number of patients diagnosed with peritonitis nos? Here are the relevant SQL tables:
CREATE TABLE procedures (
subject_... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.short_title = "Peritonitis 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. what is the number of patients who were inserted drug-eluting coronary artery stent(s) and had joint fluid lab test? Here are the relevant SQ... | 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 = "Insertion of drug-eluting coronary artery stent(s)" 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. calculate the average age of married patients on government insurance Here are the relevant SQL tables:
CREATE TABLE prescriptions (
subj... | SELECT AVG(demographic.age) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.insurance = "Government" |
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 year of birth is less than 2129 and lab test name is albumin? 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.dob_year < "2129" AND lab.label = "Albumin" |
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 hispanic/latino-puerto rican patients have lab test item id 50967? 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.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND lab.itemid = "50967" |
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 me the age and status of death of patient alice nixon. Here are the relevant SQL tables:
CREATE TABLE demographic (
subject_id text,... | SELECT demographic.age, demographic.expire_flag FROM demographic WHERE demographic.name = "Alice Nixon" |
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 drug code and route of administration of ns (mini bag plus). Here are the relevant SQL tables:
CREATE TABLE demographic (
su... | SELECT prescriptions.formulary_drug_cd, prescriptions.route FROM prescriptions WHERE prescriptions.drug = "NS (Mini Bag Plus)" |
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 were admitted in emergency room for arthrocentesis? Here are the relevant SQL tables:
CREATE TABLE diagnoses (
su... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND procedures.short_title = "Arthrocentesis" |
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 death status is 1 and diagnoses icd9 code is 317. Here are the relevant SQL tables:
CREATE TABLE diagnos... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "1" AND diagnoses.icd9_code = "317" |
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 diagnosed with hypertensive chronic kidney disease, unspecified, with chronic kidney disease stage v or end... | 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 = "Hypertensive chronic kidney disease, unspecified, with chronic kidney disease stage V or end stage renal diseas... |
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 primary disease is posterior communicating aneurysm/sda and year of birth is less than 1887? Here are th... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "POSTERIOR COMMUNICATING ANEURYSM/SDA" AND demographic.dob_year < "1887" |
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 discharge time and procedure icd9 code of subject id 91588? Here are the relevant SQL tables:
CREATE TABLE diagnoses (
subject_id... | SELECT demographic.dischtime, procedures.icd9_code FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "91588" |
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 patients aged below 62 were admitted in hospital for more than 27 days? Here are the relevant SQL tables:
CREATE TABLE proced... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.age < "62" AND demographic.days_stay > "27" |
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 gender is f and discharge location is disc-tran cancer/chldrn h? Here are the relevant SQL tables:
CREA... | SELECT MAX(demographic.age) FROM demographic WHERE demographic.gender = "F" AND demographic.discharge_location = "DISC-TRAN CANCER/CHLDRN H" |
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 time of admission for patient Dona Cole. Here are the relevant SQL tables:
CREATE TABLE demographic (
subject_id text,
ha... | SELECT demographic.admittime FROM demographic WHERE demographic.name = "Dona Cole" |
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 government health insurance patients who had other electric countershock of heart. Here are the relevant SQL tables:
CREAT... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Government" AND procedures.short_title = "Heart countershock NEC" |
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 age is less than 54 and drug name is succinylcholine? Here are the relevant SQL tables:
CREATE TABLE lab (
subjec... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "54" AND prescriptions.drug = "Succinylcholine" |
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 emergency hospital admission patients who were admitted via emergency hospital room. Here are the relevant SQL tables:
CRE... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.admission_location = "EMERGENCY ROOM ADMIT" |
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 who had arteriography of cerebral arteries and were hospitalized for more than 5 days. Here are the relevant S... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "5" AND procedures.short_title = "Contr cerebr arteriogram" |
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 year is less than 2103 and procedure icd9 code is 40? Here are the relevant SQL tables:
CREATE... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2103" AND procedures.icd9_code = "40" |
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 route of adminsitration and code for the drug Gastroview (Diatrizoate Meglumine & Sodium) Here are the relevant SQL tables:
CREAT... | SELECT prescriptions.formulary_drug_cd, prescriptions.route FROM prescriptions WHERE prescriptions.drug = "Gastroview (Diatrizoate Meglumine & Sodium)" |
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 primary disease upper gi bleed and are born before 2112? Here are the relevant SQL tables:
CREATE TABLE ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "UPPER GI BLEED" AND demographic.dob_year < "2112" |
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 primary disease is upper gi bleed and age is less than 51? Here are the relevant SQL tables:
CREATE TABL... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "UPPER GI BLEED" AND demographic.age < "51" |
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. which patients have levo500pm drug code? Here are the relevant SQL tables:
CREATE TABLE demographic (
subject_id text,
hadm_id text,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.formulary_drug_cd = "LEVO500PM" |
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 admission year is less than 2176 and diagnoses short title is hypopotassemia? Here are the relevant SQL ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2176" AND diagnoses.short_title = "Hypopotassemia" |
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 admission type is elective and lab test category is blood gas? 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 = "ELECTIVE" 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 age and procedure icd9 code of subject name estrella carroll? Here are the relevant SQL tables:
CREATE TABLE lab (
subject_id tex... | SELECT demographic.age, procedures.icd9_code FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.name = "Estrella Carroll" |
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 diagnoses icd9 code of subject id 19420? Here are the relevant SQL tables:
CREATE TABLE lab (
subject_id text,
hadm_id text,
... | SELECT diagnoses.icd9_code FROM diagnoses WHERE diagnoses.subject_id = "19420" |
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 year of birth is less than 2041 and drug route is sc? Here are the relevant SQL tables:
CREATE TABLE pre... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "2041" 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. Out of the total number of patients who died in or before the year 2174, how many of them had neoplasm of uncertain behavior of other lymphat... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "NEOPLASM OF UNCERTAIN BEHAVIOR OF OTHER LYMPHATIC AND HEMATOPOIETIC TISSUES\BONE MARROW TRANSPLANT" AND demographic.dod_year <= "2174.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. what is the number of patients whose ethnicity is white - russian and drug name is topiramate (topamax)? Here are the relevant SQL tables:
CR... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND prescriptions.drug = "Topiramate (Topamax)" |
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 procedure short title is vaccination nec? 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.admission_type = "NEWBORN" AND procedures.short_title = "Vaccination NEC" |
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. show the number of patients with procedure icd code 8852 who are younger than 31 years. Here are the relevant SQL tables:
CREATE TABLE demogr... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "31" AND procedures.icd9_code = "8852" |
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 divorced patients with 2182-12-31 17:20:00 as the lab test chart time. 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.marital_status = "DIVORCED" AND lab.charttime = "2182-12-31 17:20:00" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.