instruction
stringlengths 37
754
| output
stringlengths 9
3.43k
|
---|---|
### Instruction:
what is the yearly maximum output (ml)-nephrostomy right 10 fr. output that patient 015-16479 has had since 32 months ago?
### Response:
|
SELECT MAX(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-16479')) AND intakeoutput.celllabel = 'output (ml)-nephrostomy right 10 fr.' AND intakeoutput.cellpath LIKE '%output%' AND DATETIME(intakeoutput.intakeoutputtime) >= DATETIME(CURRENT_TIME(), '-32 month') GROUP BY STRFTIME('%y', intakeoutput.intakeoutputtime)
|
### Instruction:
return me the authors who have cited the papers by ' H. V. Jagadish ' .
### Response:
|
SELECT AUTHOR_0.name FROM author AS AUTHOR_0, author AS AUTHOR_1, cite, publication AS PUBLICATION_0, publication AS PUBLICATION_1, writes AS WRITES_0, writes AS WRITES_1 WHERE AUTHOR_1.name = 'H. V. Jagadish' AND PUBLICATION_0.pid = cite.citing AND PUBLICATION_1.pid = cite.cited AND WRITES_0.aid = AUTHOR_0.aid AND WRITES_0.pid = PUBLICATION_0.pid AND WRITES_1.aid = AUTHOR_1.aid AND WRITES_1.pid = PUBLICATION_1.pid
|
### Instruction:
calculate the number of times that patient 007-7646 had a enteral formula volume/bolus amt (ml) intake in 08/this year.
### Response:
|
SELECT COUNT(*) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-7646')) AND intakeoutput.cellpath LIKE '%intake%' AND intakeoutput.celllabel = 'enteral formula volume/bolus amt (ml)' AND DATETIME(intakeoutput.intakeoutputtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', intakeoutput.intakeoutputtime) = '08'
|
### Instruction:
i would like a morning flight from CHARLOTTE to NEWARK
### Response:
|
SELECT DISTINCT flight_id FROM flight WHERE ((from_airport IN (SELECT AIRPORT_SERVICEalias0.airport_code FROM airport_service AS AIRPORT_SERVICEalias0 WHERE AIRPORT_SERVICEalias0.city_code IN (SELECT CITYalias0.city_code FROM city AS CITYalias0 WHERE CITYalias0.city_name = 'CHARLOTTE')) AND to_airport IN (SELECT AIRPORT_SERVICEalias1.airport_code FROM airport_service AS AIRPORT_SERVICEalias1 WHERE AIRPORT_SERVICEalias1.city_code IN (SELECT CITYalias1.city_code FROM city AS CITYalias1 WHERE CITYalias1.city_name = 'NEWARK'))) AND departure_time BETWEEN 0 AND 1200)
|
### Instruction:
NoSQL Trends (# of Questions per Month).
### Response:
|
SELECT DATEADD(mm, (YEAR(Posts.CreationDate) - 1900) * 12 + MONTH(Posts.CreationDate) - 1, 0) AS Month, Tags.TagName, COUNT(*) AS Questions FROM Tags LEFT JOIN PostTags ON PostTags.TagId = Tags.Id LEFT JOIN Posts ON Posts.Id = PostTags.PostId LEFT JOIN PostTypes ON PostTypes.Id = Posts.PostTypeId WHERE Tags.TagName IN ('couchbase', 'mongodb', 'cassandra', 'riak', 'couchdb') AND PostTypes.Name = 'Question' GROUP BY YEAR(Posts.CreationDate), MONTH(Posts.CreationDate), Tags.TagName ORDER BY YEAR(Posts.CreationDate), MONTH(Posts.CreationDate), Tags.TagName
|
### Instruction:
i'd like to fly CO between BOSTON and PHILADELPHIA
### Response:
|
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PHILADELPHIA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND flight.to_airport = AIRPORT_SERVICE_0.airport_code AND flight.from_airport = AIRPORT_SERVICE_1.airport_code) AND flight.airline_code = 'CO'
|
### Instruction:
what is the percentile of 106.0 in an chloride lab test given the same age of patient 462 when they came to the hospital last time?
### Response:
|
SELECT DISTINCT t1.c1 FROM (SELECT labevents.valuenum, PERCENT_RANK() OVER (ORDER BY labevents.valuenum) AS c1 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'chloride') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age = (SELECT admissions.age FROM admissions WHERE admissions.subject_id = 462 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1))) AS t1 WHERE t1.valuenum = 106.0
|
### Instruction:
what are the early morning flights from BOSTON to DENVER
### Response:
|
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight.departure_time BETWEEN 0 AND 800
|
### Instruction:
how many days have elapsed since patient 10855 first received an intake of free water bolus on the current intensive care unit visit?
### Response:
|
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', inputevents_cv.charttime)) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 10855) AND icustays.outtime IS NULL) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'free water bolus' AND d_items.linksto = 'inputevents_cv') ORDER BY inputevents_cv.charttime LIMIT 1
|
### Instruction:
Questions Closed, Edited by No User Other Than OP, and Reopened.
### Response:
|
SELECT i.PostId AS "post_link" FROM PostHistory AS i INNER JOIN PostHistory AS c ON i.PostId = c.PostId AND i.PostHistoryTypeId = 1 AND c.PostHistoryTypeId = 10 INNER JOIN PostHistory AS r ON c.PostId = r.PostId AND r.PostHistoryTypeId = 11 LEFT OUTER JOIN PostHistory AS e ON r.PostId = e.PostId AND e.PostHistoryTypeId = 5 AND c.CreationDate < e.CreationDate AND i.UserId != e.UserId AND e.CreationDate < r.CreationDate AND e.CreationDate > c.CreationDate WHERE i.CreationDate >= DATEADD(DAY, -90, GETDATE()) AND e.PostId IS NULL GROUP BY i.PostId
|
### Instruction:
what are the four most commonly ordered procedures in patients aged 60 or above in the previous year?
### Response:
|
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age >= 60) AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY procedures_icd.icd9_code) AS t1 WHERE t1.c1 <= 4)
|
### Instruction:
what's the name of the procedure that patient 42757 was given two or more times in 11/2102?
### Response:
|
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, COUNT(procedures_icd.charttime) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 42757) AND STRFTIME('%y-%m', procedures_icd.charttime) = '2102-11' GROUP BY procedures_icd.icd9_code) AS t1 WHERE t1.c1 >= 2)
|
### Instruction:
how many days has passed since the last time that patient 006-2586 had propofol 10 mg/1 ml 100ml sdv inj prescribed during the current hospital encounter?
### Response:
|
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', medication.drugstarttime)) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-2586') AND patient.hospitaldischargetime IS NULL) AND medication.drugname = 'propofol 10 mg/1 ml 100ml sdv inj' ORDER BY medication.drugstarttime DESC LIMIT 1
|
### Instruction:
what is the name of the treatment that patient 90369 had been given two or more times until 12/2102?
### Response:
|
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, COUNT(procedures_icd.charttime) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 90369) AND STRFTIME('%y-%m', procedures_icd.charttime) <= '2102-12' GROUP BY procedures_icd.icd9_code) AS t1 WHERE t1.c1 >= 2)
|
### Instruction:
show me the flights from SAN FRANCISCO to DALLAS on CO
### Response:
|
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DALLAS' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.to_airport = AIRPORT_SERVICE_0.airport_code AND flight.from_airport = AIRPORT_SERVICE_1.airport_code) AND flight.airline_code = 'CO'
|
### Instruction:
how many hours has elapsed since the last time patient 006-105495 received a enteral vital af 1.2 intake on the current intensive care unit visit?
### Response:
|
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', intakeoutput.intakeoutputtime)) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-105495') AND patient.unitdischargetime IS NULL) AND intakeoutput.celllabel = 'enteral vital af 1.2' AND intakeoutput.cellpath LIKE '%intake%' ORDER BY intakeoutput.intakeoutputtime DESC LIMIT 1
|
### Instruction:
on 07/13/last year what was patient 027-48742's last systemicdiastolic?
### Response:
|
SELECT vitalperiodic.systemicdiastolic FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-48742')) AND NOT vitalperiodic.systemicdiastolic IS NULL AND DATETIME(vitalperiodic.observationtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m-%d', vitalperiodic.observationtime) = '07-13' ORDER BY vitalperiodic.observationtime DESC LIMIT 1
|
### Instruction:
what are the new prescriptions of patient 032-24135 today compared to the prescription yesterday.
### Response:
|
SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '032-24135') AND DATETIME(medication.drugstarttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '032-24135') AND DATETIME(medication.drugstarttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-1 day')
|
### Instruction:
tell me the volume of drain out #1 jackson pratt patient 73693 had on last month/10?
### 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 = 73693)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'drain out #1 jackson pratt' AND d_items.linksto = 'outputevents') AND DATETIME(outputevents.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') AND STRFTIME('%d', outputevents.charttime) = '10'
|
### Instruction:
which airlines fly between BOSTON and BALTIMORE
### Response:
|
SELECT DISTINCT airline.airline_code FROM airline, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALTIMORE' AND flight.airline_code = airline.airline_code AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
|
### Instruction:
until 1 year ago, what are the five frequently ordered treatments for patients with age 40s?
### Response:
|
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN 40 AND 49) AND DATETIME(procedures_icd.charttime) <= DATETIME(CURRENT_TIME(), '-1 year') GROUP BY procedures_icd.icd9_code) AS t1 WHERE t1.c1 <= 5)
|
### Instruction:
what is the difference between the total amount of input and output for patient 18866 on the current intensive care unit visit?
### Response:
|
SELECT (SELECT SUM(inputevents_cv.amount) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 18866) AND icustays.outtime IS NULL)) - (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 = 18866) AND icustays.outtime IS NULL))
|
### Instruction:
i also need service from DALLAS to BOSTON arriving by 1200
### Response:
|
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND flight.arrival_time <= 1200 AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DALLAS' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code
|
### Instruction:
how many hours has elapsed since the last time that patient 12775 had an intake of tpn on the current icu visit?
### Response:
|
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', inputevents_cv.charttime)) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 12775) AND icustays.outtime IS NULL) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'tpn' AND d_items.linksto = 'inputevents_cv') ORDER BY inputevents_cv.charttime DESC LIMIT 1
|
### Instruction:
has patient 013-38992 received an order of 100 ml bag : sodium chloride 0.9 % 0.9 % iv solp, ondansetron 2 mg/1 ml 2ml sdv inj, or enoxaparin?
### 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 = '013-38992')) AND medication.drugname IN ('100 ml bag : sodium chloride 0.9 % 0.9 % iv solp', 'ondansetron 2 mg/1 ml 2ml sdv inj', 'enoxaparin')
|
### Instruction:
Technology Trends (# Questions per Tag per Month).
### Response:
|
SELECT DATEADD(mm, (YEAR(Posts.CreationDate) - 1900) * 12 + MONTH(Posts.CreationDate) - 1, 0) AS Month, COUNT(*) AS Q FROM Tags LEFT JOIN PostTags ON PostTags.TagId = Tags.Id LEFT JOIN Posts ON Posts.Id = PostTags.PostId LEFT JOIN PostTypes ON PostTypes.Id = Posts.PostTypeId WHERE Tags.TagName IN ('primefaces') AND PostTypes.Name = 'Question' AND Posts.CreationDate < DATEADD(month, DATEDIFF(month, 0, GETDATE()), 0) GROUP BY YEAR(Posts.CreationDate), MONTH(Posts.CreationDate) ORDER BY YEAR(Posts.CreationDate), MONTH(Posts.CreationDate)
|
### Instruction:
what is the name of a procedure that patient 73713 has been given for two times since 11/2105?
### Response:
|
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, COUNT(procedures_icd.charttime) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 73713) AND STRFTIME('%y-%m', procedures_icd.charttime) >= '2105-11' GROUP BY procedures_icd.icd9_code) AS t1 WHERE t1.c1 = 2)
|
### Instruction:
Review results with links to the review page. Returns the full ReviewTaskResults table, with a link to the corresponding review page on the site.
Note that the site displays the user associated with each review task result, but the table does not.
### Response:
|
SELECT 'site://review/close/' + CAST(ReviewTaskResults.ReviewTaskId AS TEXT) + '|' + CAST(ReviewTaskResults.ReviewTaskId AS TEXT) AS "Review Link", ReviewTasks.ReviewTaskTypeId, CASE WHEN ReviewTasks.ReviewTaskTypeId = 1 THEN 'suggested-edits' ELSE 'null' END, ReviewTaskTypes.Name, ReviewTaskResults.* FROM ReviewTaskResults JOIN ReviewTasks ON ReviewTaskResults.ReviewTaskId = ReviewTasks.Id JOIN ReviewTaskTypes ON ReviewTaskTypes.Id = ReviewTasks.ReviewTaskTypeId ORDER BY ReviewTaskResults.CreationDate DESC LIMIT 50
|
### Instruction:
What are the prerequisites for me before enrolling in ITALIAN 399 ?
### Response:
|
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND NOT COURSE_0.course_id IN (SELECT STUDENT_RECORDalias0.course_id FROM student_record AS STUDENT_RECORDalias0 WHERE STUDENT_RECORDalias0.student_id = 1) AND COURSE_1.course_id = course_prerequisite.course_id AND COURSE_1.department = 'ITALIAN' AND COURSE_1.number = 399
|
### Instruction:
Average Score for Questions and Answers by Month Since 2008.
### Response:
|
SELECT TIME_TO_STR(Posts.CreationDate, '%Y') AS Year, TIME_TO_STR(Posts.CreationDate, '%m') AS Month, SUM(Score) AS SUM_SCORE, COUNT(*) AS COUNT_SCORE, AVG(CAST(Score AS FLOAT(12, 2))) AS AVG_SCORE, SUM(CASE WHEN PostTypeId < 3 THEN 1 ELSE 0 END) AS QnA FROM Posts WHERE PostTypeId < 3 GROUP BY TIME_TO_STR(Posts.CreationDate, '%Y'), TIME_TO_STR(Posts.CreationDate, '%m') HAVING TIME_TO_STR(Posts.CreationDate, '%Y') >= 2008 ORDER BY Year, Month
|
### Instruction:
how many days since the last time patient 31088 was diagnosed with mch cmp autm mplnt dfbrl during their current hospital encounter.
### Response:
|
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', diagnoses_icd.charttime)) FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'mch cmp autm mplnt dfbrl') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 31088 AND admissions.dischtime IS NULL) ORDER BY diagnoses_icd.charttime DESC LIMIT 1
|
### Instruction:
show me the UA flights which go from BOSTON to WASHINGTON
### Response:
|
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'WASHINGTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND flight.to_airport = AIRPORT_SERVICE_0.airport_code AND flight.from_airport = AIRPORT_SERVICE_1.airport_code) AND flight.airline_code = 'UA'
|
### Instruction:
Which upper level classes do not require 519 as a prerequisite ?
### Response:
|
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite, program_course WHERE NOT COURSE_1.course_id IN (SELECT course_prerequisite.pre_course_id FROM course AS COURSE_0, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.course_id) AND COURSE_1.department = 'department0' AND COURSE_1.number = 519 AND PROGRAM_COURSE_0.category LIKE '%ULCS%' AND PROGRAM_COURSE_0.course_id = COURSE_0.course_id
|
### Instruction:
list the flights from PHILADELPHIA to DALLAS on AA
### Response:
|
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DALLAS' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILADELPHIA' AND flight.to_airport = AIRPORT_SERVICE_0.airport_code AND flight.from_airport = AIRPORT_SERVICE_1.airport_code) AND flight.airline_code = 'AA'
|
### Instruction:
What classes do I have to take before I can take WOMENSTD 486 ?
### Response:
|
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND NOT COURSE_0.course_id IN (SELECT STUDENT_RECORDalias0.course_id FROM student_record AS STUDENT_RECORDalias0 WHERE STUDENT_RECORDalias0.student_id = 1) AND COURSE_1.course_id = course_prerequisite.course_id AND COURSE_1.department = 'WOMENSTD' AND COURSE_1.number = 486
|
### Instruction:
what is the name of a procedure that patient 24547 has been given for two times in 09/2104?
### Response:
|
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, COUNT(procedures_icd.charttime) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 24547) AND STRFTIME('%y-%m', procedures_icd.charttime) = '2104-09' GROUP BY procedures_icd.icd9_code) AS t1 WHERE t1.c1 = 2)
|
### Instruction:
what was the new prescription for patient 017-88691 today compared to the prescription yesterday?
### Response:
|
SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '017-88691') AND DATETIME(medication.drugstarttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '017-88691') AND DATETIME(medication.drugstarttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-1 day')
|
### Instruction:
what percentile is the value of the rdw of 14.3 among patients of the same age as patient 25723 when they visited the hospital first time?
### Response:
|
SELECT DISTINCT t1.c1 FROM (SELECT labevents.valuenum, PERCENT_RANK() OVER (ORDER BY labevents.valuenum) AS c1 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'rdw') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age = (SELECT admissions.age FROM admissions WHERE admissions.subject_id = 25723 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1))) AS t1 WHERE t1.valuenum = 14.3
|
### Instruction:
what is the percentile of 246.0 in a lab test of platelet count given the same age of patient 8016 during their first hospital visit?
### Response:
|
SELECT DISTINCT t1.c1 FROM (SELECT labevents.valuenum, PERCENT_RANK() OVER (ORDER BY labevents.valuenum) AS c1 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'platelet count') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age = (SELECT admissions.age FROM admissions WHERE admissions.subject_id = 8016 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1))) AS t1 WHERE t1.valuenum = 246.0
|
### Instruction:
for patients with an age 60 or above until 4 years ago, what are the top five most frequent diagnoses?
### Response:
|
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age >= 60) AND DATETIME(diagnoses_icd.charttime) <= DATETIME(CURRENT_TIME(), '-4 year') GROUP BY diagnoses_icd.icd9_code) AS t1 WHERE t1.c1 <= 5)
|
### Instruction:
list the flights from DALLAS to SAN FRANCISCO on AA
### Response:
|
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SAN FRANCISCO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' AND flight.to_airport = AIRPORT_SERVICE_0.airport_code AND flight.from_airport = AIRPORT_SERVICE_1.airport_code) AND flight.airline_code = 'AA'
|
### Instruction:
what was patient 9566's last time of .9% normal saline intake since 12/31/2105?
### Response:
|
SELECT inputevents_cv.charttime FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 9566)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = '.9% normal saline' AND d_items.linksto = 'inputevents_cv') AND STRFTIME('%y-%m-%d', inputevents_cv.charttime) >= '2105-12-31' ORDER BY inputevents_cv.charttime DESC LIMIT 1
|
### Instruction:
what airlines fly from BURBANK to DENVER
### Response:
|
SELECT DISTINCT airline.airline_code FROM airline, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BURBANK' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' AND flight.airline_code = airline.airline_code AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
|
### Instruction:
indicate the daily minimum sao2 of patient 14054 last month.
### Response:
|
SELECT MIN(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 14054)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'sao2' AND d_items.linksto = 'chartevents') AND DATETIME(chartevents.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') GROUP BY STRFTIME('%y-%m-%d', chartevents.charttime)
|
### Instruction:
since 2 years ago for the patients of age 60 or above, what were the top three most frequent diagnoses?
### Response:
|
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age >= 60) AND DATETIME(diagnoses_icd.charttime) >= DATETIME(CURRENT_TIME(), '-2 year') GROUP BY diagnoses_icd.icd9_code) AS t1 WHERE t1.c1 <= 3)
|
### Instruction:
since 05/2103, what was the monthly minimum dose of enteral tube feeds via gt of patient 030-10559?
### Response:
|
SELECT MIN(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-10559')) AND intakeoutput.celllabel = 'enteral tube feeds via gt' AND intakeoutput.cellpath LIKE '%intake%' AND STRFTIME('%y-%m', intakeoutput.intakeoutputtime) >= '2103-05' GROUP BY STRFTIME('%y-%m', intakeoutput.intakeoutputtime)
|
### Instruction:
on 08/28/2100, when patient 32592 got .9% normal saline for the last time?
### Response:
|
SELECT inputevents_cv.charttime FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 32592)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = '.9% normal saline' AND d_items.linksto = 'inputevents_cv') AND STRFTIME('%y-%m-%d', inputevents_cv.charttime) = '2100-08-28' ORDER BY inputevents_cv.charttime DESC LIMIT 1
|
### Instruction:
person's comments on foreign posts.
### Response:
|
SELECT comment.Id AS "comment_link", commenter.DisplayName AS commenter, CASE WHEN pop.DisplayName IS NULL THEN NULL ELSE op.DisplayName END AS answerer, CASE WHEN pop.DisplayName IS NULL THEN op.DisplayName ELSE pop.DisplayName END AS asker FROM Comments AS comment JOIN Users AS commenter ON commenter.Id = comment.UserId JOIN (Posts AS opPost JOIN Users AS op ON op.Id = opPost.OwnerUserId) ON opPost.Id = comment.PostId LEFT JOIN (Posts AS popPost JOIN Users AS pop ON pop.Id = popPost.OwnerUserId) ON popPost.Id = opPost.ParentId WHERE commenter.Id = '##UserID##' AND op.Id != '##UserID##' AND (pop.Id != '##UserID##' OR pop.Id IS NULL) ORDER BY comment.Id DESC
|
### Instruction:
i would like to fly UA from WASHINGTON to DENVER colorado
### Response:
|
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WASHINGTON' AND flight.to_airport = AIRPORT_SERVICE_0.airport_code AND flight.from_airport = AIRPORT_SERVICE_1.airport_code) AND flight.airline_code = 'UA'
|
### Instruction:
how many hours has elapsed since the last time patient 006-133605 had a per iv flush: forearm l intake on the current icu visit?
### Response:
|
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', intakeoutput.intakeoutputtime)) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-133605') AND patient.unitdischargetime IS NULL) AND intakeoutput.celllabel = 'per iv flush: forearm l' AND intakeoutput.cellpath LIKE '%intake%' ORDER BY intakeoutput.intakeoutputtime DESC LIMIT 1
|
### Instruction:
what are the three most frequently ordered procedures in patients with age 30s until 1 year ago?
### Response:
|
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN 30 AND 39) AND DATETIME(procedures_icd.charttime) <= DATETIME(CURRENT_TIME(), '-1 year') GROUP BY procedures_icd.icd9_code) AS t1 WHERE t1.c1 <= 3)
|
### Instruction:
show me the top four most common diagnoses for patients with 30s until 2100?
### Response:
|
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN 30 AND 39) AND STRFTIME('%y', diagnoses_icd.charttime) <= '2100' GROUP BY diagnoses_icd.icd9_code) AS t1 WHERE t1.c1 <= 4)
|
### Instruction:
what is the daily average value of patient 3267's weight until 07/2104?
### Response:
|
SELECT AVG(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 3267)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit wt' AND d_items.linksto = 'chartevents') AND STRFTIME('%y-%m', chartevents.charttime) <= '2104-07' GROUP BY STRFTIME('%y-%m-%d', chartevents.charttime)
|
### Instruction:
what was the name of the procedure performed to patient 23224, two times since 120 months ago?
### Response:
|
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, COUNT(procedures_icd.charttime) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 23224) AND DATETIME(procedures_icd.charttime) >= DATETIME(CURRENT_TIME(), '-120 month') GROUP BY procedures_icd.icd9_code) AS t1 WHERE t1.c1 = 2)
|
### Instruction:
i'd like UA flights from DENVER to BALTIMORE
### Response:
|
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BALTIMORE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' AND flight.to_airport = AIRPORT_SERVICE_0.airport_code AND flight.from_airport = AIRPORT_SERVICE_1.airport_code) AND flight.airline_code = 'UA'
|
### Instruction:
I haven 't taken 373 , which upper classes can I take ?
### Response:
|
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite, program_course WHERE NOT COURSE_1.course_id IN (SELECT course_prerequisite.pre_course_id FROM course AS COURSE_0, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.course_id) AND COURSE_1.department = 'department0' AND COURSE_1.number = 373 AND PROGRAM_COURSE_0.category LIKE '%ULCS%' AND PROGRAM_COURSE_0.course_id = COURSE_0.course_id
|
### Instruction:
how many hours have passed since patient 12726 had a d5w intake for the first time on the current icu visit?
### Response:
|
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', inputevents_cv.charttime)) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 12726) AND icustays.outtime IS NULL) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'd5w' AND d_items.linksto = 'inputevents_cv') ORDER BY inputevents_cv.charttime LIMIT 1
|
### Instruction:
what was the name of the procedure that patient 45612 received two or more times until 06/2101.
### Response:
|
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, COUNT(procedures_icd.charttime) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 45612) AND STRFTIME('%y-%m', procedures_icd.charttime) <= '2101-06' GROUP BY procedures_icd.icd9_code) AS t1 WHERE t1.c1 >= 2)
|
### Instruction:
what was the name of the procedure that was given two or more times to patient 1862 in 09/2100?
### Response:
|
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, COUNT(procedures_icd.charttime) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1862) AND STRFTIME('%y-%m', procedures_icd.charttime) = '2100-09' GROUP BY procedures_icd.icd9_code) AS t1 WHERE t1.c1 >= 2)
|
### Instruction:
i mean how many days has it been since the first time patient 006-133605 had a volume (ml) magnesium intake on the current intensive care unit visit?
### Response:
|
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', intakeoutput.intakeoutputtime)) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-133605') AND patient.unitdischargetime IS NULL) AND intakeoutput.celllabel = 'volume (ml) magnesium' AND intakeoutput.cellpath LIKE '%intake%' ORDER BY intakeoutput.intakeoutputtime LIMIT 1
|
### Instruction:
tell me the percentile of a magnesium level of 1.6 in patients of the same age as patient 25523 on their first hospital encounter?
### Response:
|
SELECT DISTINCT t1.c1 FROM (SELECT labevents.valuenum, PERCENT_RANK() OVER (ORDER BY labevents.valuenum) AS c1 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'magnesium') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age = (SELECT admissions.age FROM admissions WHERE admissions.subject_id = 25523 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1))) AS t1 WHERE t1.valuenum = 1.6
|
### Instruction:
what new drugs are being prescribed to patient 017-16041 today vs. yesterday?
### Response:
|
SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '017-16041') AND DATETIME(medication.drugstarttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '017-16041') AND DATETIME(medication.drugstarttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-1 day')
|
### Instruction:
what are the four most common diagnosis of patients with age 20s in 2105?
### Response:
|
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN 20 AND 29) AND STRFTIME('%y', diagnoses_icd.charttime) = '2105' GROUP BY diagnoses_icd.icd9_code) AS t1 WHERE t1.c1 <= 4)
|
### Instruction:
Tag Similarity by common occurance.
### Response:
|
SELECT COUNT(t1.PostId) AS count_match, t1.TagId, tag1.TagName, tag1.Count, t2.TagId, tag2.TagName, tag2.Count FROM PostTags AS t1 INNER JOIN PostTags AS t2 ON t1.PostId = t2.PostId INNER JOIN Tags AS tag1 ON tag1.Id = t1.TagId INNER JOIN Tags AS tag2 ON tag2.Id = t2.TagId INNER JOIN Posts ON t1.PostId = Posts.Id WHERE t1.TagId < t2.TagId AND Posts.Score >= 2 AND tag1.Count > 10 AND tag2.Count > 10 GROUP BY t1.TagId, t2.TagId, tag1.TagName, tag2.TagName, tag1.Count, tag2.Count ORDER BY count_match DESC
|
### Instruction:
what number of patients were given opn/oth rep aort vlv-tis two or more times during a year before?
### Response:
|
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, COUNT(*) AS c1 FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'opn/oth rep aort vlv-tis') AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY admissions.subject_id) AS t1 WHERE t1.c1 >= 2
|
### Instruction:
what airlines fly BOSTON to BALTIMORE
### Response:
|
SELECT DISTINCT airline.airline_code FROM airline, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALTIMORE' AND flight.airline_code = airline.airline_code AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
|
### Instruction:
what is the minimum total cost of the hospital, which includes medicines called 50 ml flex cont: magnesium sulfate 40 mg/ml ij soln during a year before?
### Response:
|
SELECT MIN(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 medication.patientunitstayid FROM medication WHERE medication.drugname = '50 ml flex cont: magnesium sulfate 40 mg/ml ij soln')) AND DATETIME(cost.chargetime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY cost.patienthealthsystemstayid) AS t1
|
### Instruction:
what is the yearly minimum dose of enteral osmolyte 1.2 that patient 015-75226 has taken until 34 days ago?
### Response:
|
SELECT MIN(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-75226')) AND intakeoutput.celllabel = 'enteral osmolyte 1.2' AND intakeoutput.cellpath LIKE '%intake%' AND DATETIME(intakeoutput.intakeoutputtime) <= DATETIME(CURRENT_TIME(), '-34 day') GROUP BY STRFTIME('%y', intakeoutput.intakeoutputtime)
|
### Instruction:
indicate the daily maximum amount of sao2 for patient 005-46456 in 11/last year.
### Response:
|
SELECT MAX(vitalperiodic.sao2) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-46456')) AND NOT vitalperiodic.sao2 IS NULL AND DATETIME(vitalperiodic.observationtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', vitalperiodic.observationtime) = '11' GROUP BY STRFTIME('%y-%m-%d', vitalperiodic.observationtime)
|
### Instruction:
on the first hospital visit, what was the monthly minimum intake of 3/4 str ultracal of patient 14467?
### Response:
|
SELECT MIN(inputevents_cv.amount) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 14467 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = '3/4 str ultracal' AND d_items.linksto = 'inputevents_cv') GROUP BY STRFTIME('%y-%m', inputevents_cv.charttime)
|
### Instruction:
what was the first urine output time of patient 032-21820 on this month/30.
### Response:
|
SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '032-21820')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput.celllabel = 'urine' AND DATETIME(intakeoutput.intakeoutputtime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') AND STRFTIME('%d', intakeoutput.intakeoutputtime) = '30' ORDER BY intakeoutput.intakeoutputtime LIMIT 1
|
### Instruction:
what was the name of the first intake of patient 24921 that they had on 09/23/last year?
### Response:
|
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT inputevents_cv.itemid FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 24921)) AND DATETIME(inputevents_cv.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m-%d', inputevents_cv.charttime) = '09-23' ORDER BY inputevents_cv.charttime LIMIT 1)
|
### Instruction:
Anonymous feedback for a certain question and its answers.
### Response:
|
SELECT COUNT(P.Id) AS VoteCount, VT.Name AS VoteType, P.Id AS "post_link", P.Id, U.DisplayName, P.Score, P.CreationDate, P.LastActivityDate FROM PostFeedback AS PF JOIN Posts AS P ON P.Id = PF.PostId JOIN Users AS U ON U.Id = P.OwnerUserId JOIN VoteTypes AS VT ON PF.VoteTypeId = VT.Id WHERE PF.IsAnonymous = 1 AND (P.Id = '##PostId##' OR P.ParentId = '##PostId##') GROUP BY P.Id, VT.Id, P.LastActivityDate, P.Score, P.CreationDate, VT.Name, U.DisplayName ORDER BY VoteCount DESC, VT.Id DESC
|
### Instruction:
what was the name of the procedure performed to patient 78076, two times since 05/2101?
### Response:
|
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, COUNT(procedures_icd.charttime) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 78076) AND STRFTIME('%y-%m', procedures_icd.charttime) >= '2101-05' GROUP BY procedures_icd.icd9_code) AS t1 WHERE t1.c1 = 2)
|
### Instruction:
what is patient 4326's minimum arterial bp [diastolic] on 01/24/2105?
### Response:
|
SELECT MIN(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 4326)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp [diastolic]' AND d_items.linksto = 'chartevents') AND STRFTIME('%y-%m-%d', chartevents.charttime) = '2105-01-24'
|
### Instruction:
how many days did it elapse since patient 52898 was first diagnosed with cardiac dysrhythmias nec in their current hospital encounter?
### Response:
|
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', diagnoses_icd.charttime)) FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'cardiac dysrhythmias nec') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 52898 AND admissions.dischtime IS NULL) ORDER BY diagnoses_icd.charttime LIMIT 1
|
### Instruction:
show me the nonstop flights from NASHVILLE to ST. LOUIS
### Response:
|
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'NASHVILLE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ST. LOUIS' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight.stops = 0
|
### Instruction:
list DAILY flights from DENVER to BALTIMORE
### Response:
|
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALTIMORE' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight.flight_days = 'DAILY'
|
### Instruction:
Recently active users whose name contains special characters or who come from China. List of China-based users by reputation score. Query, naturally, by a Chinese user.
### Response:
|
WITH CTE AS (SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id, LastAccessDate, Reputation, Location, Views, DisplayName, CASE WHEN (CAST(DisplayName AS TEXT) COLLATE Chinese_PRC_BIN) = DisplayName THEN 0 ELSE 1 END AS HasChineseChar FROM Users) SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", LastAccessDate, Reputation, Location, Views FROM CTE WHERE LOWER(Location) LIKE '%china%' OR UPPER(Location) LIKE '%CHN' OR HasChineseChar = 1 ORDER BY Reputation DESC, Views DESC, DisplayName DESC, LastAccessDate DESC
|
### Instruction:
Generalist Badge, Progress toward -- with improved sort. Of the top 40 tags, how many do I have a score of 15 in?
Need 15 score, or better, in at least 20 of the top 40 tags, to get the badge.
### Response:
|
WITH tags40 AS (SELECT TagId, COUNT(*) AS postCount FROM PostTags GROUP BY TagId ORDER BY COUNT(*) DESC LIMIT 40), answers AS (SELECT Score, ParentId FROM Posts WHERE CommunityOwnedDate IS NULL AND PostTypeId = 2 AND OwnerUserId = '##userid##') SELECT * FROM answers AS a INNER JOIN PostTags AS pt ON pt.PostId = a.ParentId RIGHT JOIN tags40 AS t40 ON t40.TagId = pt.TagId INNER JOIN Tags AS t ON t40.TagId = t.Id WHERE TagName = 'css'
|
### Instruction:
show all connecting flights from PITTSBURGH to OAKLAND
### Response:
|
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'OAKLAND' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight.connections > 0
|
### Instruction:
See comments made on my comments?. http://meta.stackexchange.com/a/271004/158100
### Response:
|
SELECT orig_id AS "comment_link", PostId AS "post_link", later_id AS "comment_link" FROM (SELECT c_orig.Id AS orig_id, c_orig.PostId, c_later.Id AS later_id, ROW_NUMBER() OVER (PARTITION BY c_later.PostId ORDER BY c_later.CreationDate) AS row FROM Comments AS c_orig INNER JOIN Comments AS c_later ON c_later.PostId = c_orig.PostId WHERE c_orig.UserId = @userid AND c_later.CreationDate > c_orig.CreationDate AND c_later.UserId != @userid) AS allcomments WHERE row = 1 ORDER BY PostId
|
### Instruction:
what was the name of the procedure that was given two times to patient 27172 since 65 months ago?
### Response:
|
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, COUNT(procedures_icd.charttime) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 27172) AND DATETIME(procedures_icd.charttime) >= DATETIME(CURRENT_TIME(), '-65 month') GROUP BY procedures_icd.icd9_code) AS t1 WHERE t1.c1 = 2)
|
### Instruction:
Question score as a function of length, normalized by views. Plots average value of (question score / number of views), +/- 1 standard deviation, as a function of binned question length.
### Response:
|
SELECT AVG(LENGTH(Body)) AS AverageLength, AVG(CAST(Score AS FLOAT) / ViewCount) AS QuestionScorePerViews, AVG(CAST(Score AS FLOAT) / ViewCount) + STDEV(CAST(Score AS FLOAT) / ViewCount) AS PlusOneSigma, AVG(CAST(Score AS FLOAT) / ViewCount) - STDEV(CAST(Score AS FLOAT) / ViewCount) AS MinusOneSigma FROM Posts WHERE PostTypeId = 1 AND LENGTH(Body) <= 8000 GROUP BY ROUND(LENGTH(Body), -2) ORDER BY ROUND(LENGTH(Body), -2)
|
### Instruction:
Kentico - questions by month.
### Response:
|
SELECT CAST(YEAR(p.CreationDate) AS TEXT(4)) + '-' + REPLACE(STR(CAST(MONTH(p.CreationDate) AS TEXT(2)), 2), SPACE(1), '0') AS "period", COUNT(p.Id) AS "count" FROM Posts AS p WHERE p.CreationDate >= '2015-01-01' AND p.CreationDate < '2017-01-01' AND p.PostTypeId = 1 AND p.Tags LIKE '%kentico%' GROUP BY CAST(YEAR(p.CreationDate) AS TEXT(4)) + '-' + REPLACE(STR(CAST(MONTH(p.CreationDate) AS TEXT(2)), 2), SPACE(1), '0') ORDER BY Period
|
### Instruction:
what percentile is the value of the anion gap in 12.0 among patients of the same age as patient 5252 in their first hospital encounter?
### Response:
|
SELECT DISTINCT t1.c1 FROM (SELECT labevents.valuenum, PERCENT_RANK() OVER (ORDER BY labevents.valuenum) AS c1 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'anion gap') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age = (SELECT admissions.age FROM admissions WHERE admissions.subject_id = 5252 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1))) AS t1 WHERE t1.valuenum = 12.0
|
### Instruction:
flights from CINCINNATI to DENVER on AA
### Response:
|
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'CINCINNATI' AND flight.to_airport = AIRPORT_SERVICE_0.airport_code AND flight.from_airport = AIRPORT_SERVICE_1.airport_code) AND flight.airline_code = 'AA'
|
### Instruction:
had patient 8098 have a respiratory rate less than 24.0 until 02/09/2104?
### Response:
|
SELECT COUNT(*) > 0 FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 8098)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'respiratory rate' AND d_items.linksto = 'chartevents') AND chartevents.valuenum < 24.0 AND STRFTIME('%y-%m-%d', chartevents.charttime) <= '2104-02-09'
|
### Instruction:
(fork) Percentage of Closed Questions by Tag.
### Response:
|
SELECT * FROM (SELECT t.TagName, COUNT(TagName) AS Closed, t.Count AS Total, ROUND(100. * COUNT(TagName) / t.Count, 3) AS "%_closed", ((CAST(t.Count AS FLOAT) / CAST(18389372 AS FLOAT)) * 100) AS "%_of_site" FROM Posts AS p INNER JOIN PostTags AS pt ON p.Id = pt.PostId INNER JOIN Tags AS t ON pt.TagId = t.Id INNER JOIN PostHistory AS h ON p.Id = h.PostId WHERE p.PostTypeId = 1 AND NOT p.ClosedDate IS NULL AND h.PostHistoryTypeId = 10 GROUP BY TagName, t.Count) AS a ORDER BY 'total' DESC, TagName
|
### Instruction:
what airlines fly between BOSTON and ATLANTA
### Response:
|
SELECT DISTINCT airline.airline_code FROM airline, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND flight.airline_code = airline.airline_code AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
|
### Instruction:
indicate the yearly average amount of temperature c (calc) for patient 1912 since 116 months ago.
### Response:
|
SELECT AVG(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1912)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'temperature c (calc)' AND d_items.linksto = 'chartevents') AND DATETIME(chartevents.charttime) >= DATETIME(CURRENT_TIME(), '-116 month') GROUP BY STRFTIME('%y', chartevents.charttime)
|
### Instruction:
closed edited and reopened questions.
### Response:
|
WITH closed_and_edited AS (SELECT c.PostId, MIN(e.CreationDate) AS EditDate FROM PostHistory AS c INNER JOIN PostHistory AS e ON c.PostId = e.PostId AND c.PostHistoryTypeId = 10 AND e.PostHistoryTypeId = 5 WHERE c.CreationDate < e.CreationDate GROUP BY c.PostId) SELECT COUNT(*) AS "Closed and edited", COUNT(oa.PostId) AS "Closed, edited and reopened", ROUND(COUNT(oa.PostId) * 100.0 / COUNT(*), 2) AS "%" FROM closed_and_edited AS q LEFT JOIN LATERAL (SELECT PostId FROM PostHistory WHERE PostId = q.PostId AND PostHistoryTypeId = 11 AND CreationDate >= q.EditDate) AS oa
|
### Instruction:
how many flights does AA have from BOSTON to ATLANTA
### Response:
|
SELECT COUNT(DISTINCT flight.flight_id) FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight.airline_code = 'AA'
|
### Instruction:
does YX serve INDIANAPOLIS
### Response:
|
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE ((flight.to_airport = AIRPORT_SERVICE_0.airport_code AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'INDIANAPOLIS') OR (flight.from_airport = AIRPORT_SERVICE_1.airport_code AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'INDIANAPOLIS')) AND flight.airline_code = 'YX'
|
### Instruction:
flights on TW from COLUMBUS to ST. LOUIS
### Response:
|
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ST. LOUIS' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'COLUMBUS' AND flight.to_airport = AIRPORT_SERVICE_0.airport_code AND flight.from_airport = AIRPORT_SERVICE_1.airport_code) AND flight.airline_code = 'TW'
|
### Instruction:
what was the name of the procedure that patient 90369 received two times until 11/2105.
### Response:
|
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, COUNT(procedures_icd.charttime) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 90369) AND STRFTIME('%y-%m', procedures_icd.charttime) <= '2105-11' GROUP BY procedures_icd.icd9_code) AS t1 WHERE t1.c1 = 2)
|
### Instruction:
Most frequent tags in answers of the given user.
### Response:
|
SELECT RANK() OVER (ORDER BY COUNT(a.Id) DESC) AS "rank", t.TagName, COUNT(a.Id) AS "count", SUM(a.Score) AS "score", SUM(CASE WHEN (a.CommunityOwnedDate IS NULL) THEN 1 ELSE 0 END) AS "non-cw", SUM(CASE WHEN (a.CommunityOwnedDate IS NULL) THEN a.Score ELSE 0 END) AS "non-cw_score" FROM Posts AS a INNER JOIN Posts AS q ON q.Id = a.ParentId INNER JOIN PostTags AS pt ON pt.PostId = q.Id INNER JOIN Tags AS t ON t.Id = pt.TagId WHERE a.OwnerUserId = '##userid?8297##' GROUP BY t.TagName ORDER BY COUNT(a.Id) DESC
|
### Instruction:
Metrics - Users - Accumulated PU Ratio by Quarter.
### Response:
|
SELECT r AS Registrated, COUNT(1) AS Users, SUM(s) AS Writers, ROUND(SUM(s) * 100.0 / COUNT(1), 2) AS "writers_%" FROM (SELECT u.Id, (CASE WHEN SUM(CASE WHEN p.PostTypeId = 2 AND (p.Score >= @minVote) THEN 1 ELSE 0 END) >= @minPost THEN 1 ELSE 0 END) AS s, (TIME_TO_STR(u.CreationDate, '%Y') * 100 + TIME_TO_STR(u.CreationDate, '%q')) AS r FROM Users AS u LEFT JOIN Posts AS p ON p.OwnerUserId = u.Id GROUP BY u.Id, u.CreationDate) AS X GROUP BY r ORDER BY r
|
### Instruction:
what are the new drugs today of patient 016-9636 compared to those prescribed yesterday?
### Response:
|
SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '016-9636') AND DATETIME(medication.drugstarttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '016-9636') AND DATETIME(medication.drugstarttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-1 day')
|
### Instruction:
since 112 months ago, what was the daily maximum weight of patient 28277?
### Response:
|
SELECT MAX(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 28277)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit wt' AND d_items.linksto = 'chartevents') AND DATETIME(chartevents.charttime) >= DATETIME(CURRENT_TIME(), '-112 month') GROUP BY STRFTIME('%y-%m-%d', chartevents.charttime)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.