instruction
stringlengths 37
754
| output
stringlengths 9
3.43k
|
---|---|
### Instruction:
Are we going to have a lab for Computational Fluid Dynamics of Nuclear Applications this year ?
### Response:
|
SELECT COUNT(*) > 0 FROM course, course_offering, semester WHERE (course.description LIKE '%lab%' OR course.name LIKE '%lab%') AND (course.description LIKE '%Computational Fluid Dynamics of Nuclear Applications%' OR course.name LIKE '%Computational Fluid Dynamics of Nuclear Applications%') AND course.course_id = course_offering.course_id AND semester.semester_id = course_offering.semester AND semester.year = 2016
|
### Instruction:
how many times did patient 018-20179 have received vasopressors - norepinephrine <= 0.1 micrograms/kg/min?
### Response:
|
SELECT COUNT(*) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '018-20179')) AND treatment.treatmentname = 'vasopressors - norepinephrine <= 0.1 micrograms/kg/min'
|
### Instruction:
severe sepsis and at least 1 the following: low blood pressure prior to volume expansion ( sbp < 100 ) ; glasgow coma scale < 13 ; skin mottling score > 2
### Response:
|
SELECT * FROM table_train_73 WHERE severe_sepsis = 1 AND (CASE WHEN systolic_blood_pressure_sbp < 100 THEN 1 ELSE 0 END + CASE WHEN glasgow_come_score_gcs < 13 THEN 1 ELSE 0 END + CASE WHEN skin_mottling_score > 2 THEN 1 ELSE 0 END) >= 1
|
### Instruction:
Accepted answer has fewer votes than other answer(s) to question.
### Response:
|
SELECT q.Id AS "post_link", q.Score AS QuestionScore, aa.Score AS AcceptedScore, naa.Score AS NotAcceptedScore FROM Posts AS q INNER JOIN PostTypes AS pt ON q.PostTypeId = pt.Id JOIN Posts AS aa ON aa.Id = q.AcceptedAnswerId JOIN Posts AS naa ON naa.Id != q.AcceptedAnswerId AND naa.ParentId = q.Id WHERE naa.Score > aa.Score AND naa.Score > 0 ORDER BY naa.Score DESC, aa.Score
|
### Instruction:
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, give me the comparison about the sum of salary over the job_id , and group by attribute job_id, and list y axis in asc order please.
### Response:
|
SELECT JOB_ID, SUM(SALARY) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID ORDER BY SUM(SALARY)
|
### Instruction:
Show the number of courses for each instructor in a stacked bar chart. The x-axis is instructor's first name and group by course description.
### Response:
|
SELECT EMP_FNAME, COUNT(EMP_FNAME) FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM JOIN COURSE AS T3 ON T1.CRS_CODE = T3.CRS_CODE JOIN PROFESSOR AS T4 ON T2.EMP_NUM = T4.EMP_NUM GROUP BY CRS_DESCRIPTION, EMP_FNAME
|
### Instruction:
what is the total amount of syringe (neonatal) *d5w* prescribed to patient 6170 since 12/2105?
### Response:
|
SELECT SUM(prescriptions.dose_val_rx) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 6170) AND prescriptions.drug = 'syringe (neonatal) *d5w*' AND STRFTIME('%y-%m', prescriptions.startdate) >= '2105-12'
|
### Instruction:
what was the four most commonly taken laboratory test since 6 years ago for a patient aged 30s?
### Response:
|
SELECT t1.labname FROM (SELECT lab.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 30 AND 39) AND DATETIME(lab.labresulttime) >= DATETIME(CURRENT_TIME(), '-6 year') GROUP BY lab.labname) AS t1 WHERE t1.c1 <= 4
|
### Instruction:
give me the number of patients whose primary disease is atrial septal defect\mitral valve replacement;repair atrial-septal defect/sda and procedure icd9 code is 3613?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "ATRIAL SEPTAL DEFECT\MITRAL VALVE REPLACEMENT;REPAIR ATRIAL-SEPTAL DEFECT/SDA" AND procedures.icd9_code = "3613"
|
### Instruction:
For those employees who do not work in departments with managers that have ids between 100 and 200, give me the comparison about the average of employee_id over the hire_date bin hire_date by weekday by a bar chart, and show by the mean employee id from high to low.
### Response:
|
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(EMPLOYEE_ID) DESC
|
### Instruction:
until 2104 what are the four most commonly ordered medications for patients of age 60 or above?
### Response:
|
SELECT t1.drugname FROM (SELECT medication.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age >= 60) AND STRFTIME('%y', medication.drugstarttime) <= '2104' GROUP BY medication.drugname) AS t1 WHERE t1.c1 <= 4
|
### Instruction:
Is A History of Modern Psychology only taught by one person , Prof. Hull ?
### Response:
|
SELECT DISTINCT course.department, course.name, course.number, instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.name LIKE '%A History of Modern Psychology%' AND NOT instructor.name LIKE '%Hull%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id
|
### Instruction:
has quetiapine fumarate, phenylephrine, or ondansetron been prescribed until 05/2101 for patient 1372?
### Response:
|
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1372) AND prescriptions.drug IN ('quetiapine fumarate', 'phenylephrine', 'ondansetron') AND STRFTIME('%y-%m', prescriptions.startdate) <= '2101-05'
|
### Instruction:
what is the name of the drug patient 017-61209 was first prescribed during the first hospital visit?
### Response:
|
SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-61209' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1)) ORDER BY medication.drugstarttime LIMIT 1
|
### Instruction:
until 3 years ago, had patient 029-16737 had a surgery consultation?
### Response:
|
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '029-16737')) AND treatment.treatmentname = 'surgery consultation' AND DATETIME(treatment.treatmenttime) <= DATETIME(CURRENT_TIME(), '-3 year')
|
### Instruction:
For those employees who do not work in departments with managers that have ids between 100 and 200, find hire_date and the average of employee_id bin hire_date by time, and visualize them by a bar chart, and display by the mean employee id from high to low.
### Response:
|
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(EMPLOYEE_ID) DESC
|
### Instruction:
During the Fall or Winter terms , are any 500 -level classes being offered ?
### Response:
|
SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number BETWEEN 500 AND 500 + 100 AND semester.semester IN ('FA', 'WN') AND semester.semester_id = course_offering.semester AND semester.year = 2016
|
### Instruction:
what are the top four prescription drugs among the patients with age 60 or above until 2103?
### Response:
|
SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age >= 60) AND STRFTIME('%y', prescriptions.startdate) <= '2103' GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 <= 4
|
### Instruction:
until 04/2102, what was the daily average weight of patient 002-39753?
### Response:
|
SELECT AVG(patient.admissionweight) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-39753') AND NOT patient.admissionweight IS NULL AND STRFTIME('%y-%m', patient.unitadmittime) <= '2102-04' GROUP BY STRFTIME('%y-%m-%d', patient.unitadmittime)
|
### Instruction:
what was the name of the lab test, which patient 013-17922 first received until 07/2104?
### Response:
|
SELECT lab.labname FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-17922')) AND STRFTIME('%y-%m', lab.labresulttime) <= '2104-07' ORDER BY lab.labresulttime LIMIT 1
|
### Instruction:
Which classes need BIOSTAT 524 as a prerequisite ?
### Response:
|
SELECT DISTINCT COURSE_1.department, COURSE_1.name, COURSE_1.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND COURSE_0.department = 'BIOSTAT' AND COURSE_0.number = 524 AND COURSE_1.course_id = course_prerequisite.course_id
|
### Instruction:
how many patients were diagnosed with celiac disease since 2105?
### Response:
|
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT diagnoses_icd.hadm_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'celiac disease') AND STRFTIME('%y', diagnoses_icd.charttime) >= '2105')
|
### Instruction:
count the number of patients whose diagnoses long title is migraine, unspecified, without mention of intractable migraine without mention of status migrainosus and lab test abnormal status is abnormal?
### Response:
|
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 = "Migraine, unspecified, without mention of intractable migraine without mention of status migrainosus" AND lab.flag = "abnormal"
|
### Instruction:
count the number of times that until 2104 patient 004-4326 received a non-invasive ventilation procedure.
### Response:
|
SELECT COUNT(*) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-4326')) AND treatment.treatmentname = 'non-invasive ventilation' AND STRFTIME('%y', treatment.treatmenttime) <= '2104'
|
### Instruction:
For Spring and Summer what courses meet the MDE requirement ?
### Response:
|
SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.course_id WHERE program_course.category LIKE '%MDE%' AND semester.semester IN ('SP', 'SS', 'SU') AND semester.year = 2016
|
### Instruction:
when did patient 030-44598 during the current hospital visit have the minimum creatinine for the last time?
### Response:
|
SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-44598' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = 'creatinine' ORDER BY lab.labresult, lab.labresulttime DESC LIMIT 1
|
### Instruction:
when was patient 15821 prescribed for the last time a drug in 01/this year?
### Response:
|
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 15821) AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', prescriptions.startdate) = '01' ORDER BY prescriptions.startdate DESC LIMIT 1
|
### Instruction:
answers for a tag that have been awarded bounties, most recent answers first.. Shows answers for a tag that have been awarded bounties, most recent answers first.
### Response:
|
SELECT post.Id AS "post_link", vote.BountyAmount AS Bounty, post.CreationDate AS Date, parent.Tags FROM Posts AS post JOIN Votes AS vote ON vote.PostId = post.Id JOIN Posts AS parent ON post.ParentId = parent.Id WHERE vote.VoteTypeId = 9 AND vote.BountyAmount != 0 AND parent.Tags LIKE '%<##Tag##>%' ORDER BY post.CreationDate DESC
|
### Instruction:
what is the maximum amount of hospital cost that includes -polys until 3 years ago?
### Response:
|
SELECT MAX(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT lab.patientunitstayid FROM lab WHERE lab.labname = '-polys')) AND DATETIME(cost.chargetime) <= DATETIME(CURRENT_TIME(), '-3 year') GROUP BY cost.patienthealthsystemstayid) AS t1
|
### Instruction:
Tumbleweeds and Scholars over the years.
### Response:
|
SELECT YEAR(Date), SUM(CASE WHEN Name = 'Scholar' THEN 1 ELSE 0 END) AS Scholars, SUM(CASE WHEN Name = 'Tumbleweed' THEN 1 ELSE 0 END) AS Tumbleweeds, SUM(CASE WHEN Name = 'Lifejacket' THEN 1 ELSE 0 END) AS LJ, SUM(CASE WHEN Name = 'Lifeboat' THEN 1 ELSE 0 END) AS LB FROM Badges WHERE YEAR(Date) < YEAR(CURRENT_TIMESTAMP()) GROUP BY YEAR(Date)
|
### Instruction:
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, return a bar chart about the distribution of hire_date and the average of salary bin hire_date by time, order by the y axis in ascending.
### Response:
|
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY AVG(SALARY)
|
### Instruction:
Average number of questions per day, over a week - about Apache Beam + Stack Overflow.
### Response:
|
SELECT MIN(Posts.CreationDate) AS period, SUM(CASE WHEN Posts.PostTypeId = 1 THEN 1 ELSE 0 END) AS "questions per month" FROM Posts WHERE Posts.PostTypeId = 1 AND (Posts.Tags LIKE '%apache-beam%' OR Posts.Tags LIKE '%google-cloud-dataflow%') GROUP BY TIME_TO_STR(Posts.CreationDate, '%m'), TIME_TO_STR(Posts.CreationDate, '%Y') ORDER BY period
|
### Instruction:
Everyone's favourite questions for a tag. Non community wiki questions on a particular tag
### Response:
|
SELECT FavoriteCount, Posts.Id, Title, 'http://stackoverflow.com/questions/' + CAST(Posts.Id AS TEXT) + '/' AS Link FROM Posts JOIN PostTags ON Posts.Id = PostTags.PostId JOIN Tags ON PostTags.TagId = Tags.Id WHERE Posts.PostTypeId = 1 AND Tags.TagName = '##Tag:string##' AND CommunityOwnedDate IS NULL AND FavoriteCount >= '##MinFavCount:int##' ORDER BY FavoriteCount DESC
|
### Instruction:
Search comments by any keyword, after a specified date, with excluded word.
### Response:
|
SELECT c.CreationDate, c.Text, c.Id AS "comment_link", c.PostId AS "post_link" FROM Comments AS c WHERE c.CreationDate > '##yyyy##' + '-' + '##mm##' + '-' + '##dd##' + 'T00:00:00.000' AND (Text LIKE '%##SearchOnKeyword1##%' OR Text LIKE '%##SearchOnKeyword2##%') AND NOT Text LIKE '%##ExcludeThisWord1##%' LIMIT 100
|
### Instruction:
Who teaches 532 besides Prof. Patricia Reuter-lorenz ?
### Response:
|
SELECT DISTINCT instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number = 532 AND NOT instructor.name LIKE '%Patricia Reuter-lorenz%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id
|
### Instruction:
when was patient 012-35970 tested for a lab test for the first time in 01/2103?
### Response:
|
SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-35970')) AND STRFTIME('%y-%m', lab.labresulttime) = '2103-01' ORDER BY lab.labresulttime LIMIT 1
|
### Instruction:
Prof. Radosevich is the only person who teaches Medieval Music , correct ?
### Response:
|
SELECT DISTINCT course.department, course.name, course.number, instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.name LIKE '%Medieval Music%' AND NOT instructor.name LIKE '%Radosevich%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id
|
### Instruction:
Top users for the Cassandra tag.
### Response:
|
SELECT Users.DisplayName, COUNT(*) AS UpVotes FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts ON Posts.ParentId = PostTags.PostId INNER JOIN Votes ON Votes.PostId = Posts.Id AND VoteTypeId = 2 INNER JOIN Users ON Users.Id = Posts.OwnerUserId WHERE Tags.Id = 34113 AND Posts.CreationDate > '2015-01-01 00:00:00' GROUP BY Users.DisplayName ORDER BY UpVotes DESC
|
### Instruction:
Show me a bar chart for what are all the employee ids and the names of the countries in which they work?, and list bar in descending order.
### Response:
|
SELECT COUNTRY_NAME, SUM(EMPLOYEE_ID) FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID JOIN locations AS T3 ON T2.LOCATION_ID = T3.LOCATION_ID JOIN countries AS T4 ON T3.COUNTRY_ID = T4.COUNTRY_ID GROUP BY COUNTRY_NAME ORDER BY COUNTRY_NAME DESC
|
### Instruction:
whats the maximum heartrate on the last icu visit for patient 011-23004.
### Response:
|
SELECT MAX(vitalperiodic.heartrate) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '011-23004') AND NOT patient.unitdischargetime IS NULL ORDER BY patient.unitadmittime DESC LIMIT 1) AND NOT vitalperiodic.heartrate IS NULL
|
### Instruction:
For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the distribution of hire_date and the average of employee_id bin hire_date by time in a bar chart, and could you order in asc by the mean employee id please?
### Response:
|
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(EMPLOYEE_ID)
|
### Instruction:
Top Viewed Question By Tag.
### Response:
|
WITH ViewsByTag AS (SELECT pt.TagId, p.ViewCount, ROW_NUMBER() OVER (PARTITION BY pt.TagId ORDER BY p.ViewCount DESC) AS "rank" FROM Posts AS p INNER JOIN PostTags AS pt ON pt.PostId = p.Id) SELECT RANK() OVER (ORDER BY vt.ViewCount DESC) AS "rank", t.TagName, vt.ViewCount FROM ViewsByTag AS vt INNER JOIN Tags AS t ON vt.TagId = t.Id WHERE vt.Rank = 1 ORDER BY vt.ViewCount DESC
|
### Instruction:
what was the first time patient 008-10139 last month received a lab test?
### Response:
|
SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '008-10139')) AND DATETIME(lab.labresulttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') ORDER BY lab.labresulttime LIMIT 1
|
### Instruction:
what is patient 13806's minimum uric acid, urine value since 108 months ago?
### Response:
|
SELECT MIN(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 13806) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'uric acid, urine') AND DATETIME(labevents.charttime) >= DATETIME(CURRENT_TIME(), '-108 month')
|
### Instruction:
what was the first diagnosis for patient 007-1517 until 1 year ago.
### Response:
|
SELECT diagnosis.diagnosisname FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-1517')) AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CURRENT_TIME(), '-1 year') ORDER BY diagnosis.diagnosistime LIMIT 1
|
### Instruction:
If I need to fulfill the ULCS requirement , what 's the easiest class I can take ?
### Response:
|
SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 WHERE PROGRAM_COURSEalias1.category LIKE '%ULCS%')
|
### Instruction:
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, give me the comparison about the average of salary over the hire_date bin hire_date by time, show by the y-axis in ascending please.
### Response:
|
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY AVG(SALARY)
|
### Instruction:
when patient 030-67523 had the first treatment of hyperkalemia - insulin / glucose?
### Response:
|
SELECT treatment.treatmenttime FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-67523')) AND treatment.treatmentname = 'treatment of hyperkalemia - insulin / glucose' ORDER BY treatment.treatmenttime LIMIT 1
|
### Instruction:
Finding basic thank you comments (fewer than 20 characters).
### Response:
|
SELECT c.Id AS "comment_link", c.Text AS "comment_body", (SELECT COUNT(c.Id) AS "comment_link" FROM Comments AS c WHERE (c.Text LIKE '%thank%' OR c.Text LIKE '%thx%') AND LENGTH(c.Text) < 20) AS "total_comments" FROM Comments AS c WHERE (c.Text LIKE '%thank%' OR c.Text LIKE '%thx%') AND LENGTH(c.Text) < 20 ORDER BY c.CreationDate DESC
|
### Instruction:
what is the yearly maximum bands value for patient 28020 until 2103?
### Response:
|
SELECT MAX(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 28020) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'bands') AND STRFTIME('%y', labevents.charttime) <= '2103' GROUP BY STRFTIME('%y', labevents.charttime)
|
### Instruction:
Top tags (with more than 4 posts) by country (Brazil/Brasil) since 2017.
### Response:
|
SELECT Tags.TagName, COUNT(*) FROM PostTags JOIN Posts ON Posts.Id = PostTags.PostId JOIN Users ON Users.Id = Posts.OwnerUserId JOIN Tags ON Tags.Id = PostTags.TagId WHERE YEAR(Posts.CreationDate) >= 2017 AND (LOWER(Users.Location) LIKE '%brasil%' OR LOWER(Users.Location) LIKE '%brazil%') GROUP BY Tags.TagName HAVING COUNT(*) > 4 ORDER BY 2 DESC
|
### Instruction:
During the Spring and Summer term how many 500 -level classes are being offered ?
### Response:
|
SELECT COUNT(DISTINCT course.course_id, semester.semester) FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'department0' AND course.number BETWEEN 500 AND 500 + 100 AND semester.semester IN ('SP', 'SS', 'SU') AND semester.semester_id = course_offering.semester AND semester.year = 2016
|
### Instruction:
has any microbiology test been performed on patient 031-23724 the last year?
### Response:
|
SELECT COUNT(*) > 0 FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-23724')) AND DATETIME(microlab.culturetakentime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')
|
### Instruction:
what were the five most common laboratory tests until 3 years ago for patients of age 30s?
### Response:
|
SELECT t1.labname FROM (SELECT lab.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 30 AND 39) AND DATETIME(lab.labresulttime) <= DATETIME(CURRENT_TIME(), '-3 year') GROUP BY lab.labname) AS t1 WHERE t1.c1 <= 5
|
### Instruction:
how many patients have a married marital status and were diagnosed with surgical operation with implant of artificial internal device causing abnormal patient reaction, or later complication,without mention of misadventure at time of operation?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "MARRIED" AND diagnoses.long_title = "Surgical operation with implant of artificial internal device causing abnormal patient reaction, or later complication,without mention of misadventure at time of operation"
|
### Instruction:
had diltiazem, pantoprazole or isotonic sodium chloride been since 6 years ago prescribed for patient 26612?
### Response:
|
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26612) AND prescriptions.drug IN ('diltiazem', 'pantoprazole', 'isotonic sodium chloride') AND DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-6 year')
|
### Instruction:
since 2105 was patient 010-21105 prescribed clonidine hcl?
### Response:
|
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-21105')) AND medication.drugname = 'clonidine hcl' AND STRFTIME('%y', medication.drugstarttime) >= '2105'
|
### Instruction:
what is patient 009-16880's last diagnosis on their first hospital visit?
### Response:
|
SELECT diagnosis.diagnosisname FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-16880' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1)) ORDER BY diagnosis.diagnosistime DESC LIMIT 1
|
### Instruction:
what exactly was the first drug that patient 10811 was prescribed in 02/last year?
### Response:
|
SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 10811) AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', prescriptions.startdate) = '02' ORDER BY prescriptions.startdate LIMIT 1
|
### Instruction:
What is on offer in the way of hardware courses for Spring and Summer of 2019 ?
### Response:
|
SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course INNER JOIN area ON course.course_id = area.course_id INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE area.area LIKE '%hardware%' AND semester.semester IN ('SP', 'SU', 'SS') AND semester.year = 2019
|
### Instruction:
count the number of times that patient 17398 underwent a opn/oth rep mtrl vlv-tis procedure.
### Response:
|
SELECT COUNT(*) FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'opn/oth rep mtrl vlv-tis') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 17398)
|
### Instruction:
what was the total output of patient 59797's jp #2 medial?
### Response:
|
SELECT SUM(outputevents.value) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 59797)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'jp #2 medial' AND d_items.linksto = 'outputevents')
|
### Instruction:
since 09/2104 has patient 005-87465 had a cortisol lab test?
### Response:
|
SELECT COUNT(*) > 0 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-87465')) AND lab.labname = 'cortisol' AND STRFTIME('%y-%m', lab.labresulttime) >= '2104-09'
|
### Instruction:
Server Faults Qns & Ans.
### Response:
|
SELECT q.Id, q.AcceptedAnswerId, q.Body AS qBody, q.Title AS qTitle, q.Tags AS qTags, q.CommentCount AS qCommentCount, q.Score AS qScore, a.Id, a.Body AS aBody, a.Score AS aScore, a.CommentCount AS aCommentCount FROM Posts AS q INNER JOIN Posts AS a ON (q.AcceptedAnswerId = a.Id) WHERE YEAR(q.CreationDate) > 2013 AND YEAR(q.CreationDate) < 2019
|
### Instruction:
Users with CSS gold badge.
### Response:
|
SELECT ROW_NUMBER() OVER (ORDER BY u.DisplayName), b.UserId, u.DisplayName AS Name FROM Users AS u, Badges AS b, Badges AS html, Badges AS js WHERE b.Name = 'css' AND b.Class = 1 AND html.Name = 'html' AND html.Class = 1 AND js.Name = 'javascript' AND js.Class = 1 AND u.Id = b.UserId AND u.Id = html.UserId AND u.Id = js.UserId GROUP BY b.Date, b.UserId, u.DisplayName
|
### Instruction:
Count upvotes on top 10 most common tags.
### Response:
|
SELECT TagName, COUNT(*) AS UpVotes FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts ON Posts.ParentId = PostTags.PostId INNER JOIN Votes ON Votes.PostId = Posts.Id AND VoteTypeId = 2 WHERE TagName IN (SELECT t.TagName FROM Tags AS t INNER JOIN PostTags AS pt ON pt.TagId = t.Id INNER JOIN Posts AS p ON pt.PostId = p.Id GROUP BY t.TagName ORDER BY COUNT(*) DESC LIMIT 10) GROUP BY TagName
|
### Instruction:
how much phenytoin sodium was prescribed for the last time until 01/2101 to patient 62977?
### Response:
|
SELECT prescriptions.dose_val_rx FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 62977) AND prescriptions.drug = 'phenytoin sodium' AND STRFTIME('%y-%m', prescriptions.startdate) <= '2101-01' ORDER BY prescriptions.startdate DESC LIMIT 1
|
### Instruction:
what is the total minimum cost of a hospital that includes a drug called miconazole powder 2% during the previous year?
### Response:
|
SELECT MIN(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT prescriptions.hadm_id FROM prescriptions WHERE prescriptions.drug = 'miconazole powder 2%') AND DATETIME(cost.chargetime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY cost.hadm_id) AS t1
|
### Instruction:
count the number of times that patient 26398 received a laboratory test for vancomycin in a month before.
### Response:
|
SELECT COUNT(*) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'vancomycin') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26398) AND DATETIME(labevents.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month')
|
### Instruction:
since 158 months ago, what was the daily maximum weight of patient 017-70504?
### Response:
|
SELECT MAX(patient.admissionweight) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-70504') AND NOT patient.admissionweight IS NULL AND DATETIME(patient.unitadmittime) >= DATETIME(CURRENT_TIME(), '-158 month') GROUP BY STRFTIME('%y-%m-%d', patient.unitadmittime)
|
### Instruction:
what was the name of the first lab test patient 006-43795 had received since 06/2103?
### Response:
|
SELECT lab.labname FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-43795')) AND STRFTIME('%y-%m', lab.labresulttime) >= '2103-06' ORDER BY lab.labresulttime LIMIT 1
|
### Instruction:
patient 70267 was diagnosed with a cl skul base fx/brf coma?
### Response:
|
SELECT COUNT(*) > 0 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'cl skul base fx/brf coma') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 70267)
|
### Instruction:
has patient 030-53416 been treated since 2105 with a ct scan - spine procedure?
### Response:
|
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-53416')) AND treatment.treatmentname = 'ct scan - spine' AND STRFTIME('%y', treatment.treatmenttime) >= '2105'
|
### Instruction:
Other than Prof. Jaye Stapleton , name the professors who teach 552 .
### Response:
|
SELECT DISTINCT instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number = 552 AND NOT instructor.name LIKE '%Jaye Stapleton%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id
|
### Instruction:
Are there any courses which require taking RESTORA 746 first ?
### Response:
|
SELECT DISTINCT COURSE_1.department, COURSE_1.name, COURSE_1.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND COURSE_0.department = 'RESTORA' AND COURSE_0.number = 746 AND COURSE_1.course_id = course_prerequisite.course_id
|
### Instruction:
what was the four most commonly taken laboratory tests in 2101 for patients of the age 20s?
### Response:
|
SELECT t1.labname FROM (SELECT lab.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 20 AND 29) AND STRFTIME('%y', lab.labresulttime) = '2101' GROUP BY lab.labname) AS t1 WHERE t1.c1 <= 4
|
### Instruction:
what is the daily average amount of rbc, pleural patient 15794 has on the current hospital visit?
### Response:
|
SELECT AVG(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 15794 AND admissions.dischtime IS NULL) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'rbc, pleural') GROUP BY STRFTIME('%y-%m-%d', labevents.charttime)
|
### Instruction:
Are there any courses in the Fall or Winter that meet the Other requirement ?
### Response:
|
SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.course_id WHERE program_course.category LIKE '%Other%' AND semester.semester IN ('FA', 'WN') AND semester.year = 2016
|
### Instruction:
when was the last time that patient 004-86136 has the minimum sodium on their current hospital encounter?
### Response:
|
SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-86136' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = 'sodium' ORDER BY lab.labresult, lab.labresulttime DESC LIMIT 1
|
### Instruction:
What class is the hardest ?
### Response:
|
SELECT DISTINCT course.name, course.number, program_course.workload FROM course, program_course WHERE course.department = 'EECS' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MAX(PROGRAM_COURSEalias1.workload) FROM course AS COURSEalias1, program_course AS PROGRAM_COURSEalias1 WHERE COURSEalias1.course_id = PROGRAM_COURSEalias1.course_id AND COURSEalias1.department = 'EECS')
|
### Instruction:
Interesting Recent Unanswered Salesforce Questions From Newbies.
### Response:
|
SELECT p.Id, p.Title, p.Tags, p.CreationDate FROM Posts AS p INNER JOIN Users AS u ON u.Id = p.OwnerUserId WHERE u.Reputation < 200 AND p.CreationDate > (CURRENT_TIMESTAMP() - 20) AND AnswerCount = 0 AND CommentCount = 0 AND NOT Tags LIKE '%marketing-cloud%' AND NOT Tags LIKE '%lightning%' AND NOT Tags LIKE '%javascript%' AND NOT Tags LIKE '%salesforcedx%' ORDER BY p.CreationDate DESC
|
### Instruction:
Compare number of Questions per week, for 3 given tags, over a specified period.
### Response:
|
SELECT DATEADD(week, DATEDIFF(week, 0, CreationDate), 0), COUNT(*) FROM PostTags AS pt JOIN Posts AS q ON q.Id = pt.PostId WHERE pt.TagId = 93513 AND q.CreationDate > '2016-07-10' GROUP BY DATEADD(week, DATEDIFF(week, 0, CreationDate), 0) ORDER BY DATEADD(week, DATEDIFF(week, 0, CreationDate), 0)
|
### Instruction:
tell me the name of the laboratory test which patient 033-10593 first received since 101 months ago?
### Response:
|
SELECT lab.labname FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '033-10593')) AND DATETIME(lab.labresulttime) >= DATETIME(CURRENT_TIME(), '-101 month') ORDER BY lab.labresulttime LIMIT 1
|
### Instruction:
What was the '{\mathrm{h,cc}} = \frac{c_{\mathrm{aq}}}{c_{\mathrm{gas}}}' if '_{\mathrm{h,cp}} = \frac{c_\mathrm{aq}}{p}' is 7.8 10 4?
### Response:
|
SELECT "k_{\\mathrm{H,cc}} = \\frac{c_{\\mathrm{aq}}}{c_{\\mathrm{gas}}}" FROM table_26347 WHERE "k_{\\mathrm{H,cp}} = \\frac{c_\\mathrm{aq}}{p}" = '7.8 × 10−4'
|
### Instruction:
last time, what drug was prescribed for patient 88659 in 10/last year?
### Response:
|
SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 88659) AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', prescriptions.startdate) = '10' ORDER BY prescriptions.startdate DESC LIMIT 1
|
### Instruction:
what was the three most frequently taken lab test until 2103 for patients over the age of 50s?
### Response:
|
SELECT t1.labname FROM (SELECT lab.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 50 AND 59) AND STRFTIME('%y', lab.labresulttime) <= '2103' GROUP BY lab.labname) AS t1 WHERE t1.c1 <= 3
|
### Instruction:
count the number of times that patient 30733 had received a eosinophils test during the previous year?
### Response:
|
SELECT COUNT(*) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'eosinophils') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 30733) AND DATETIME(labevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')
|
### Instruction:
Is there a 16 -credit upper level class in Summer 2012 ?
### Response:
|
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program_course, semester WHERE course.course_id = course_offering.course_id AND course.credits = 16 AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = 'Summer' AND semester.semester_id = course_offering.semester AND semester.year = 2012
|
### Instruction:
give the number of patients whose diagnosis long title is major depressive affective disorder, recurrent episode, severe, specified as with psychotic behavior and the drug route is ou.
### Response:
|
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 = "Major depressive affective disorder, recurrent episode, severe, specified as with psychotic behavior" AND prescriptions.route = "OU"
|
### Instruction:
Any 400 -level classes held in Spring or Summer term ?
### Response:
|
SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number BETWEEN 400 AND 400 + 100 AND semester.semester IN ('SP', 'SS', 'SU') AND semester.semester_id = course_offering.semester AND semester.year = 2016
|
### Instruction:
what was the four most common lab test done since 3 years ago for patients aged 30s?
### Response:
|
SELECT t1.labname FROM (SELECT lab.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 30 AND 39) AND DATETIME(lab.labresulttime) >= DATETIME(CURRENT_TIME(), '-3 year') GROUP BY lab.labname) AS t1 WHERE t1.c1 <= 4
|
### Instruction:
What courses does Prof. Rachel Croskery-roberts teach besides 329 ?
### Response:
|
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.number <> 329 AND instructor.name LIKE '%Rachel Croskery-roberts%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id
|
### Instruction:
500 -level classes , are they offered in the Fall or Winter term ?
### Response:
|
SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number BETWEEN 500 AND 500 + 100 AND semester.semester IN ('FA', 'WN') AND semester.semester_id = course_offering.semester AND semester.year = 2016
|
### Instruction:
Who teaches CSP 100 ?
### Response:
|
SELECT COUNT(instructor.name), instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'CSP' AND course.number = 100 AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id GROUP BY instructor.name ORDER BY COUNT(instructor.name) DESC LIMIT 5
|
### Instruction:
when did patient 3516 receive the first calculated total co2 lab test until 42 months ago?
### Response:
|
SELECT labevents.charttime FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'calculated total co2') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 3516) AND DATETIME(labevents.charttime) <= DATETIME(CURRENT_TIME(), '-42 month') ORDER BY labevents.charttime LIMIT 1
|
### Instruction:
how many total doses of neo*iv*caffeine citrate was prescribed to patient 85010 last month?
### Response:
|
SELECT SUM(prescriptions.dose_val_rx) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 85010) AND prescriptions.drug = 'neo*iv*caffeine citrate' AND DATETIME(prescriptions.startdate, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month')
|
### Instruction:
Time distribution of upvotes on all the questions of a given user. It prints the time distribution of all the questions of a given user
### Response:
|
SELECT Posts.Id AS "post_link", Votes.CreationDate AS "Date", COUNT(Posts.Score) AS "Total upvotes" FROM Votes INNER JOIN Posts ON Posts.Id = Votes.PostId AND Votes.VoteTypeId = 2 AND Posts.OwnerUserId = '##UserId##' AND Posts.PostTypeId = 1 GROUP BY Posts.Title, Posts.Id, Votes.CreationDate ORDER BY Posts.Id
|
### Instruction:
hey what was patient 10855's average lactate value this month?
### Response:
|
SELECT AVG(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 10855) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'lactate') AND DATETIME(labevents.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month')
|
### Instruction:
what was patient 010-16627's monthly minimum value of body weight until 30 months ago?
### Response:
|
SELECT MIN(patient.admissionweight) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-16627') AND NOT patient.admissionweight IS NULL AND DATETIME(patient.unitadmittime) <= DATETIME(CURRENT_TIME(), '-30 month') GROUP BY STRFTIME('%y-%m', patient.unitadmittime)
|
### Instruction:
since 2105 has patient 025-44842 been prescribed nicoderm cq.
### Response:
|
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-44842')) AND medication.drugname = 'nicoderm cq' AND STRFTIME('%y', medication.drugstarttime) >= '2105'
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.