instruction
stringlengths 57
490
| output
stringlengths 69
1.29k
|
---|---|
### Instruction:
list DAILY flights from OAKLAND to BOSTON using TW
### 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 = 'OAKLAND' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight.airline_code = 'TW') AND flight.flight_days = 'DAILY' |
### Instruction:
what is the distance between PITTSBURGH airport and downtown PITTSBURGH
### Response:
| SELECT DISTINCT AIRPORT_SERVICE_0.miles_distant FROM airport, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1 WHERE airport.airport_code = AIRPORT_SERVICE_0.airport_code AND airport.airport_code = AIRPORT_SERVICE_1.airport_code AND CITY_0.city_code = AIRPORT_SERVICE_1.city_code AND CITY_0.city_name = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_0.city_code AND CITY_1.city_name = 'PITTSBURGH' |
### Instruction:
find the flights that leave PHILADELPHIA and arrive in DALLAS 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 = 'DALLAS' 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 = 'PHILADELPHIA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code |
### Instruction:
i would like information on TW flights from WASHINGTON to 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 = 'WASHINGTON' AND flight.to_airport = AIRPORT_SERVICE_0.airport_code AND flight.from_airport = AIRPORT_SERVICE_1.airport_code) AND flight.airline_code = 'TW' |
### Instruction:
i'd like to know what flights UA has from DALLAS to SAN FRANCISCO
### 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 = 'UA' |
### Instruction:
the number of times that patient 594 had taken tpn d5.0 on 05/02/this year.
### Response:
| SELECT COUNT(*) 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 = 594)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'tpn d5.0' AND d_items.linksto = 'inputevents_cv') AND DATETIME(inputevents_cv.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m-%d', inputevents_cv.charttime) = '05-02' |
### Instruction:
early morning flights between CINCINNATI and TAMPA
### 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 = 'CINCINNATI' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'TAMPA' 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:
what was the name of the procedure that was given two times to patient 51200 a month before?
### 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 = 51200) AND DATETIME(procedures_icd.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') GROUP BY procedures_icd.icd9_code) AS t1 WHERE t1.c1 = 2) |
### Instruction:
how many days have passed since the first time that patient 12726 had a .9% normal saline intake on the current icu 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 = 12726) AND icustays.outtime IS NULL) 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') ORDER BY inputevents_cv.charttime LIMIT 1 |
### Instruction:
Those times you were stupid and you asked twice on the same day. ... so they don't count for the Asking Days badges curious/inquisitive/socratic.
### Response:
| SELECT questions.Id AS "post_link", DATE(questions.CreationDate) AS "date", initialQs.Id AS "post_link" FROM Posts AS questions JOIN Posts AS initialQs ON DATE(initialQs.CreationDate) = DATE(questions.CreationDate) WHERE questions.OwnerUserId = '##UserId##' AND questions.PostTypeId = 1 AND initialQs.OwnerUserId = '##UserId##' AND initialQs.PostTypeId = 1 GROUP BY questions.CreationDate, questions.Id, initialQs.Id, DATE(initialQs.CreationDate) HAVING questions.CreationDate > MIN(initialQs.CreationDate) ORDER BY questions.CreationDate DESC |
### Instruction:
list the morning flights between ATLANTA and DALLAS
### 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 = 'ATLANTA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' 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 1200 |
### Instruction:
What are the prerequisites for GSI Randall Payne 's course ?
### Response:
| SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0 INNER JOIN course_prerequisite ON COURSE_0.course_id = course_prerequisite.pre_course_id INNER JOIN course AS COURSE_1 ON COURSE_1.course_id = course_prerequisite.course_id INNER JOIN course_offering ON COURSE_1.course_id = course_offering.course_id INNER JOIN gsi ON gsi.course_offering_id = course_offering.offering_id INNER JOIN student ON student.student_id = gsi.student_id WHERE student.firstname LIKE 'Randall' AND student.lastname LIKE 'Payne' |
### 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:
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:
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:
Number of valuable PTIJ posts per year.
### Response:
| SELECT TIME_TO_STR(p.CreationDate, '%y') AS year, p.Id, p.Score, p_a.AnswerCount FROM Posts AS p INNER JOIN PostTags AS pt ON p.Id = pt.PostId INNER JOIN Tags AS t ON pt.TagId = t.Id AND t.TagName = 'purim-torah-in-jest' INNER JOIN (SELECT ParentId, COUNT(p.Id) AS answercount FROM Posts AS p INNER JOIN PostTags AS pt ON p.Id = pt.PostId INNER JOIN Tags AS t ON pt.TagId = t.Id AND t.TagName = 'purim-torah-in-jest' WHERE p.PostTypeId = 2 GROUP BY p.ParentId) AS p_a ON p_a.ParentId = p.Id WHERE p.PostTypeId = 1 |
### Instruction:
Highest scoring questions and answers in each tag.
### Response:
| SELECT TagName, QuestionID AS "post_link", q_.Score AS "q_score", AnswerID AS "post_link", a_.Score AS "a_score" FROM (SELECT TagName, (SELECT q.Id FROM Posts AS q INNER JOIN PostTags AS qt ON q.Id = qt.PostId WHERE qt.TagId = t.Id ORDER BY q.Score DESC LIMIT 1) AS QuestionID, (SELECT a.Id FROM Posts AS a INNER JOIN PostTags AS at ON a.ParentId = at.PostId WHERE at.TagId = t.Id ORDER BY a.Score DESC LIMIT 1) AS AnswerID FROM Tags AS t) AS temp INNER JOIN Posts AS q_ ON temp.QuestionId = q_.Id LEFT OUTER JOIN Posts AS a_ ON temp.AnswerId = a_.Id ORDER BY q_.Score DESC |
### Instruction:
tell me the percentile of mcv 97.0 in patients of the same age as patient 2127 during the last 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 = 'mcv') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age = (SELECT admissions.age FROM admissions WHERE admissions.subject_id = 2127 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1))) AS t1 WHERE t1.valuenum = 97.0 |
### Instruction:
i live in DENVER and i'd like to make a trip to PITTSBURGH
### 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 = 'PITTSBURGH' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code |
### Instruction:
what is the daily maximum amount of bicarb drip that patient 5364 took on their first hospital visit?
### Response:
| SELECT MAX(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 = 5364 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 = 'bicarb drip' AND d_items.linksto = 'inputevents_cv') GROUP BY STRFTIME('%y-%m-%d', inputevents_cv.charttime) |
### Instruction:
had patient 4469 have a arterial bp [diastolic] greater than 68.0 during the first hospital encounter?
### 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 = 4469 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp [diastolic]' AND d_items.linksto = 'chartevents') AND chartevents.valuenum > 68.0 |
### Instruction:
looking for a flight from DC to MINNESOTA
### 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, state WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.state_code = 'DC' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code AND state.state_code = CITY_1.state_code AND state.state_name = 'MINNESOTA' |
### Instruction:
Which Winter courses are only offered then ?
### Response:
| SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE course.department = 'EECS' AND semester.semester = 'Winter' AND (SELECT COUNT(DISTINCT SEMESTERalias1.semester) FROM course AS COURSEalias1 INNER JOIN course_offering ON COURSEalias1.course_id = course_offering.course_id INNER JOIN semester AS SEMESTERalias1 ON SEMESTERalias1.semester_id = course_offering.semester WHERE course.course_id = COURSEalias1.course_id) = 1 |
### Instruction:
how much did patient 8562 weigh last measured in the previous month?
### Response:
| SELECT 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 = 8562)) 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, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') ORDER BY chartevents.charttime DESC LIMIT 1 |
### Instruction:
in 08/this year, when was the last time patient 028-62326 was prescribed a medication via the pr?
### Response:
| SELECT 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 = '028-62326')) AND medication.routeadmin = 'pr' AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', medication.drugstarttime) = '08' ORDER BY medication.drugstarttime DESC LIMIT 1 |
### Instruction:
character-id, object-id posts (Sci Fi SE).
### Response:
| SELECT MIN(q.CreationDate) AS qda, MIN(q.Tags) AS qgl, 'site://q/' + CAST(q.Id AS TEXT) + '/' + CAST(MIN(m.Id) AS TEXT) + '|' + MIN(q.Title) AS qtl FROM Posts AS q LEFT JOIN (PostTags AS a JOIN Tags AS g ON a.TagId = g.Id) ON q.Id = a.PostId LEFT JOIN Users AS m ON m.AccountId = 1192385 WHERE q.PostTypeId = 1 AND g.TagName IN ('character-identification', 'object-identification', 'actor-identification', 'scene-identification') GROUP BY q.Id ORDER BY qda, q.Id |
### Instruction:
indicate the daily average amount of sao2 for patient 594 on the last hospital visit.
### 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 = 594 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'sao2' AND d_items.linksto = 'chartevents') GROUP BY STRFTIME('%y-%m-%d', chartevents.charttime) |
### Instruction:
how many days has it been since patient 006-14121 was first diagnosed with s/p exploratory laparotomy in the in the current hospital encounter?
### Response:
| SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', diagnosis.diagnosistime)) FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-14121' AND patient.hospitaldischargetime IS NULL)) AND diagnosis.diagnosisname = 's/p exploratory laparotomy' ORDER BY diagnosis.diagnosistime LIMIT 1 |
### Instruction:
i want to fly from BOSTON to SAN FRANCISCO
### 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 = 'SAN FRANCISCO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code |
### Instruction:
please show all flights from PHILADELPHIA to DEN airport next sunday
### Response:
| SELECT DISTINCT flight.flight_id FROM airport, airport_service, city, date_day, days, flight WHERE (airport.airport_code = 'DEN' AND date_day.day_number = 27 AND date_day.month_number = 8 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = airport.airport_code) AND city.city_code = airport_service.city_code AND city.city_name = 'PHILADELPHIA' AND flight.from_airport = airport_service.airport_code |
### Instruction:
how many days have passed since last ascorbic acid 500 mg tab was prescribed to patient 013-28507 in this hospital visit?
### 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 = '013-28507') AND patient.hospitaldischargetime IS NULL) AND medication.drugname = 'ascorbic acid 500 mg tab' ORDER BY medication.drugstarttime DESC LIMIT 1 |
### Instruction:
what flights are there from MEMPHIS to LAS VEGAS
### 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 = 'MEMPHIS' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'LAS VEGAS' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code |
### Instruction:
Posts with activity after your last comment.
### Response:
| SELECT P.Id AS "post_link", P.LastActivityDate, C.Id AS "comment_link", C.CreationDate, P.OwnerUserId AS "user_link", P.LastEditorUserId AS "user_link" FROM Comments AS C INNER JOIN Posts AS P ON P.Id = C.PostId WHERE C.UserId = '##UserId:int##' AND C.CreationDate = (SELECT MAX(a.CreationDate) FROM Comments AS a WHERE a.UserId = C.UserId AND a.PostId = C.PostId) AND (C.CreationDate < P.LastActivityDate) AND (P.OwnerUserId != C.UserId) AND (P.LastEditorUserId != C.UserId) ORDER BY P.LastActivityDate DESC |
### Instruction:
What are the names of the tourist attractions that have parking or shopping as their feature details?
### Response:
| SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN Tourist_Attraction_Features AS T2 ON T1.tourist_attraction_id = T2.tourist_attraction_id JOIN Features AS T3 ON T2.Feature_ID = T3.Feature_ID WHERE T3.feature_Details = 'park' UNION SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN Tourist_Attraction_Features AS T2 ON T1.tourist_attraction_id = T2.tourist_attraction_id JOIN Features AS T3 ON T2.Feature_ID = T3.Feature_ID WHERE T3.feature_Details = 'shopping' |
### Instruction:
What are the specifics of availability for section in RCHUMS 586 from the hour of 9:00 to 4:00 ?
### Response:
| SELECT DISTINCT course_offering.end_time, course_offering.section_number, course_offering.start_time FROM course, course_offering, semester WHERE course_offering.end_time <= '4:00' AND course_offering.start_time >= '9:00' AND course.course_id = course_offering.course_id AND course.department = 'RCHUMS' AND course.number = 586 AND semester.semester = 'WN' AND semester.semester_id = course_offering.semester AND semester.year = 2016 |
### Instruction:
What class is easier if the choice is between EECS 555 and EECS 651 ?
### Response:
| SELECT DISTINCT course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE (course.number = 555 OR course.number = 651) AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 INNER JOIN course AS COURSEalias1 ON PROGRAM_COURSEalias1.course_id = COURSEalias1.course_id WHERE (COURSEalias1.number = 555 OR COURSEalias1.number = 651) AND COURSEalias1.department = 'EECS') |
### Instruction:
history of stroke ( s ) with lasting impairment to vision or the visual system, coagulopathy, uncontrolled hypertension ( i.e., systolic bp > 170 or diastolic bp > 100 ) and uncontrolled or insulin requiring diabetes.
### Response:
| SELECT * FROM table_train_145 WHERE stroke = 1 AND (visual_impairment = 1 OR visual_impairment = 1 OR coagulopathy = 1 OR hypertension = 1 OR (systolic_blood_pressure_sbp > 170 OR diastolic_blood_pressure_dbp > 100)) OR (uncontrolled = 1 OR insulin_requiring_diabetes = 1) |
### Instruction:
awt', 'swing', 'javafx', 'wpf', 'qt', 'swt', 'jsf', 'gwt', 'vaadin', 'wicket'.
### Response:
| SELECT DATEADD(month, DATEDIFF(month, 0, CreationDate), 0) AS m, TagName, COUNT(*) FROM PostTags AS pt JOIN Posts AS q ON q.Id = pt.PostId JOIN Tags AS t ON t.Id = pt.TagId WHERE TagName IN ('awt', 'swing', 'javafx', 'wpf', 'qt', 'swt', 'jsf', 'gwt', 'vaadin', 'wicket') GROUP BY DATEADD(month, DATEDIFF(month, 0, CreationDate), 0), TagName ORDER BY DATEADD(month, DATEDIFF(month, 0, CreationDate), 0) |
### Instruction:
i need a ticket from NASHVILLE to SEATTLE
### 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 = 'SEATTLE' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code |
### Instruction:
Have I taken any courses that are among the most difficult in the NERS department ?
### Response:
| SELECT DISTINCT course.department, course.name, course.number, program_course.workload FROM course INNER JOIN student_record ON student_record.course_id = course.course_id INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.department = 'NERS' AND program_course.workload = (SELECT MAX(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 INNER JOIN course AS COURSEalias1 ON PROGRAM_COURSEalias1.course_id = COURSEalias1.course_id WHERE COURSEalias1.department = 'NERS') AND student_record.student_id = 1 |
### Instruction:
show flights from ATLANTA 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 = 'ATLANTA' 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 |
### Instruction:
Which tags are coming with which tags most likely together?.
### Response:
| SELECT MIN(SrcTags.TagName) AS "tagname", MIN(DstTags.TagName) AS HasAlso, 1.0 * COUNT(*) / MIN(SrcTags.Count) AS P FROM PostTags AS SrcPostTags, PostTags AS DstPostTags, Tags AS SrcTags, Tags AS DstTags WHERE SrcPostTags.PostId = DstPostTags.PostId AND SrcPostTags.TagId != DstPostTags.TagId AND SrcTags.Id = SrcPostTags.TagId AND DstTags.Id = DstPostTags.TagId GROUP BY SrcPostTags.TagId, DstPostTags.TagId HAVING COUNT(*) < MIN(SrcTags.Count) ORDER BY P DESC LIMIT 100 |
### Instruction:
tell me the name of the organism found on the last sputum, expectorated microbiology test of patient 031-15417 until 20 months ago?
### Response:
| SELECT microlab.organism FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-15417')) AND microlab.culturesite = 'sputum, expectorated' AND DATETIME(microlab.culturetakentime) <= DATETIME(CURRENT_TIME(), '-20 month') ORDER BY microlab.culturetakentime DESC LIMIT 1 |
### Instruction:
when patient 002-20631 was prescribed furosemide (lasix) tab 40 mg first time a month before.
### Response:
| SELECT 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 = '002-20631')) AND medication.drugname = 'furosemide (lasix) tab 40 mg' AND DATETIME(medication.drugstarttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') ORDER BY medication.drugstarttime LIMIT 1 |
### Instruction:
show me all flights from MIAMI to NEW YORK
### 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 = 'MIAMI' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'NEW YORK' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code |
### Instruction:
what was the last output on 12/31/this year for patient 55360?
### Response:
| SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT outputevents.itemid 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 = 55360)) AND DATETIME(outputevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m-%d', outputevents.charttime) = '12-31' ORDER BY outputevents.charttime DESC LIMIT 1) |
### Instruction:
what was the name of the drug that was prescribed two times to patient 013-28507 since 10/2104?
### Response:
| SELECT t1.drugname FROM (SELECT medication.drugname, COUNT(medication.drugstarttime) AS c1 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-28507')) AND STRFTIME('%y-%m', medication.drugstarttime) >= '2104-10' GROUP BY medication.drugname) AS t1 WHERE t1.c1 = 2 |
### Instruction:
what was the average daily number of patients who were admitted for hernia, site nec w obstr until 3 years ago?
### Response:
| SELECT AVG(t1.c1) FROM (SELECT COUNT(DISTINCT diagnoses_icd.hadm_id) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'hernia, site nec w obstr') AND DATETIME(diagnoses_icd.charttime) <= DATETIME(CURRENT_TIME(), '-3 year') GROUP BY STRFTIME('%y-%m-%d', diagnoses_icd.charttime)) AS t1 |
### Instruction:
Questions with a specific tag and no other tags.
### Response:
| SELECT Id AS "post_link", Tags FROM Posts WHERE PostTypeId = 1 AND NOT Tags LIKE '<star-trek>' AND (Tags LIKE '<star-trek-%>' OR Tags LIKE '<the-wrath-of-khan>' OR Tags LIKE '<the-search-for-spock>' OR Tags LIKE '<the-voyage-home>' OR Tags LIKE '<the-final-frontier>' OR Tags LIKE '<the-undiscovered-country>' OR Tags LIKE '<uss-enterprise>' OR Tags LIKE '<federation>' OR Tags LIKE '<vulcan>' OR Tags LIKE '<klingon>' OR Tags LIKE '<romulan>' OR Tags LIKE '<borg>' OR Tags LIKE '<changeling>' OR Tags LIKE '<klingon-language>') ORDER BY Tags, Title |
### Instruction:
flight from BOSTON 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 = 'BOSTON' 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 |
### Instruction:
in this year, did patient 033-4763 get a anticonvulsants - valproate operation in other hospitals?
### Response:
| SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '033-4763' AND patient.hospitalid <> (SELECT DISTINCT patient.hospitalid FROM patient WHERE patient.uniquepid = '033-4763' AND patient.hospitaldischargetime IS NULL)) AND treatment.treatmentname = 'anticonvulsants - valproate' AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') |
### Instruction:
when was patient 017-45919 first received mannitol - bolus .25-.5 gms/kg during this year?
### 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 = '017-45919')) AND treatment.treatmentname = 'mannitol - bolus .25-.5 gms/kg' AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') ORDER BY treatment.treatmenttime LIMIT 1 |
### Instruction:
has there been any organism found in the last sputum, tracheal specimen microbiological test of patient 031-17834 in 2105?
### 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-17834')) AND microlab.culturesite = 'sputum, tracheal specimen' AND STRFTIME('%y', microlab.culturetakentime) = '2105' ORDER BY microlab.culturetakentime DESC LIMIT 1 |
### Instruction:
show all flights on LH out of BOSTON
### 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 flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight.airline_code = 'LH' |
### Instruction:
when did patient 010-16572 last have a maximum value of systemicsystolic during yesterday?
### Response:
| SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-16572')) AND NOT vitalperiodic.systemicsystolic IS NULL AND DATETIME(vitalperiodic.observationtime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-1 day') ORDER BY vitalperiodic.systemicsystolic DESC, vitalperiodic.observationtime DESC LIMIT 1 |
### Instruction:
what was the last time that patient 70516 had a maximum value of anion gap in 11/last year?
### Response:
| SELECT labevents.charttime FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 70516) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'anion gap') AND DATETIME(labevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', labevents.charttime) = '11' ORDER BY labevents.valuenum DESC, labevents.charttime DESC LIMIT 1 |
### Instruction:
give me the CO flights from SEATTLE
### 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 = 'SEATTLE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight.airline_code = 'CO' |
### Instruction:
Find Question with Specific Tag, Title and Answer Text.
### Response:
| SELECT P.Id AS "post_link", P.Tags FROM Posts AS P, PostTags AS Pt, Tags AS T WHERE P.Id = Pt.PostId AND T.Id = Pt.TagId AND T.TagName = '##tag1##' AND P.Title LIKE '%##titleText##%' AND P.PostTypeId = 1 AND P.AnswerCount > 0 AND NOT P.AcceptedAnswerId IS NULL AND NOT (SELECT P2.Id FROM Posts AS P2 WHERE P2.Id = P.AcceptedAnswerId AND P2.Body LIKE '%##answerText##%') IS NULL AND (SELECT COUNT(Pt.TagId) FROM PostTags AS Pt WHERE Pt.PostId = P.Id) = 1 |
### Instruction:
Are there multiple professors who teach ECON 631 in Spring-Summer 2003 ?
### Response:
| SELECT COUNT(DISTINCT instructor.instructor_id) FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.department = 'ECON' AND course.number = 631 AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id AND semester.semester = 'Spring-Summer' AND semester.semester_id = course_offering.semester AND semester.year = 2003 |
### Instruction:
what was the minimum daily number of patients who had malig neo bladder nec until 2 years ago?
### Response:
| SELECT MIN(t1.c1) FROM (SELECT COUNT(DISTINCT diagnoses_icd.hadm_id) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'malig neo bladder nec') AND DATETIME(diagnoses_icd.charttime) <= DATETIME(CURRENT_TIME(), '-2 year') GROUP BY STRFTIME('%y-%m-%d', diagnoses_icd.charttime)) AS t1 |
### Instruction:
how many patients whose ethnicity is hispanic/latino - puerto rican and diagnoses long title is closed fracture of base of skull with subarachnoid, subdural, and extradural hemorrhage, with loss of consciousness of unspecified duration?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND diagnoses.long_title = "Closed fracture of base of skull with subarachnoid, subdural, and extradural hemorrhage, with loss of consciousness of unspecified duration" |
### Instruction:
how much did patient 19144 weigh last measured in their first hospital visit?
### Response:
| SELECT 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 = 19144 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit wt' AND d_items.linksto = 'chartevents') ORDER BY chartevents.charttime DESC LIMIT 1 |
### Instruction:
when was patient 12572 since 4 years ago last diagnosed with ileostomy status?
### Response:
| SELECT 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 = 'ileostomy status') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 12572) AND DATETIME(diagnoses_icd.charttime) >= DATETIME(CURRENT_TIME(), '-4 year') ORDER BY diagnoses_icd.charttime DESC LIMIT 1 |
### Instruction:
In Summer of 2009 , how many professors taught CHEMBIO 502 ?
### Response:
| SELECT COUNT(DISTINCT instructor.instructor_id) FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.department = 'CHEMBIO' AND course.number = 502 AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id AND semester.semester = 'Summer' AND semester.semester_id = course_offering.semester AND semester.year = 2009 |
### Instruction:
how many patients underwent a packed cell transfusion two times since 2104?
### 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 = 'packed cell transfusion') AND STRFTIME('%y', procedures_icd.charttime) >= '2104' GROUP BY admissions.subject_id) AS t1 WHERE t1.c1 = 2 |
### Instruction:
tags distribution on the major legal tags non-legal related.
### Response:
| SELECT t.TagName, COUNT(*) AS "number_of_question" FROM PostTags AS pt INNER JOIN PostTags AS bpt ON pt.PostId = bpt.PostId INNER JOIN Tags AS bt ON bt.Id = bpt.TagId INNER JOIN Tags AS t ON t.Id = pt.TagId AND t.Id != bt.Id WHERE bt.TagName = '##tag##' AND t.TagName NOT IN ('licensing', 'gpl', 'open-source', 'lgpl', 'legal', 'mit-license', 'apache-license', 'commercial', 'gplv3', 'license-key', 'bsd-license') GROUP BY t.TagName ORDER BY COUNT(*) DESC LIMIT 100 |
### Instruction:
how much is the minimum total hospital cost that includes prsnl hst oth nfct parst since 2105?
### Response:
| SELECT MIN(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.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 = 'prsnl hst oth nfct parst')) AND STRFTIME('%y', cost.chargetime) >= '2105' GROUP BY cost.hadm_id) AS t1 |
### Instruction:
In next semester does Prof. Erkut Ozbay teach 445 ?
### Response:
| SELECT COUNT(*) > 0 FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number = 445 AND instructor.name LIKE '%Erkut Ozbay%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016 |
### Instruction:
Comments asking the downvoter to explain.
### Response:
| SELECT Comments.Id AS "comment_link", Comments.UserId AS "user_link", Posts.ClosedDate AS Closed, Comments.CreationDate FROM Comments INNER JOIN Posts ON Comments.PostId = Posts.Id WHERE (LOWER(Text) LIKE '%@downvoter%' OR LOWER(Text) LIKE '%downvoter%' OR LOWER(Text) LIKE '%the downvote%' OR LOWER(Text) LIKE '%downvote%' OR LOWER(Text) LIKE '%down-voter%' OR LOWER(Text) LIKE '%@down-voter%') AND Comments.CreationDate > '2019-01-01' ORDER BY Comments.CreationDate DESC |
### Instruction:
Will I be able to take 502 on Mondays and Wednesdays ?
### Response:
| SELECT COUNT(*) > 0 FROM course, course_offering, semester WHERE course_offering.friday = 'N' AND course_offering.monday = 'Y' AND course_offering.thursday = 'N' AND course_offering.tuesday = 'N' AND course_offering.wednesday = 'Y' AND course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number = 502 AND semester.semester = 'WN' AND semester.semester_id = course_offering.semester AND semester.year = 2016 |
### Instruction:
Who is the instructor for Core Winter classes ?
### Response:
| SELECT DISTINCT instructor.name 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 INNER JOIN offering_instructor ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id WHERE program_course.category LIKE '%Core%' AND semester.semester = 'Winter' AND semester.year = 2017 |
### Instruction:
what was the total amount of blood loss that patient 022-82169 had on 10/23/2102.
### Response:
| SELECT SUM(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 = '022-82169')) AND intakeoutput.celllabel = 'blood loss' AND intakeoutput.cellpath LIKE '%output%' AND STRFTIME('%y-%m-%d', intakeoutput.intakeoutputtime) = '2102-10-23' |
### Instruction:
what procedure is provided to patient 027-24468 two times until 40 months ago?
### Response:
| SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, COUNT(treatment.treatmenttime) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-24468')) AND DATETIME(treatment.treatmenttime) <= DATETIME(CURRENT_TIME(), '-40 month') GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 = 2 |
### Instruction:
Is 418 having 2 or 3 lectures a week ?
### Response:
| SELECT DISTINCT course_offering.friday, course_offering.monday, course_offering.saturday, course_offering.sunday, course_offering.thursday, course_offering.tuesday, course_offering.wednesday, semester.semester, semester.year FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number = 418 AND semester.semester_id = course_offering.semester ORDER BY semester.semester_id DESC LIMIT 10 |
### Instruction:
How many different professors teach LHC 561 in Spring 2015 ?
### Response:
| SELECT COUNT(DISTINCT instructor.instructor_id) FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.department = 'LHC' AND course.number = 561 AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id AND semester.semester = 'Spring' AND semester.semester_id = course_offering.semester AND semester.year = 2015 |
### Instruction:
when did patient 032-4849 have an intake for the first time since 08/16/2104?
### 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-4849')) AND intakeoutput.cellpath LIKE '%intake%' AND STRFTIME('%y-%m-%d', intakeoutput.intakeoutputtime) >= '2104-08-16' ORDER BY intakeoutput.intakeoutputtime LIMIT 1 |
### Instruction:
Top Answerers for Tag: score = weighted sum of #accepted + #votes.
### Response:
| SELECT P.OwnerUserId AS "user_link", @AcceptWeight * SUM(CASE WHEN Q.AcceptedAnswerId = P.Id THEN 1 ELSE 0 END) + @ScoreWeight * SUM(P.Score) AS "TotalScore", COUNT(*) AS "#Answers" FROM Posts AS P INNER JOIN Posts AS Q ON Q.Id = P.ParentId INNER JOIN PostTags AS PT ON PT.PostId = Q.Id INNER JOIN Tags AS T ON T.Id = PT.TagId WHERE T.TagName = '##TagName##' AND NOT P.OwnerUserId IS NULL GROUP BY P.OwnerUserId ORDER BY 'TotalScore' DESC LIMIT 20 |
### Instruction:
what are the four most frequently ordered procedures for patients with ages 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) GROUP BY procedures_icd.icd9_code) AS t1 WHERE t1.c1 <= 4) |
### Instruction:
how many days has passed since the last time patient 007-16517 got a alkaline phos. lab test during this hospital visit?
### Response:
| SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', 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 = '007-16517' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = 'alkaline phos.' ORDER BY lab.labresulttime DESC LIMIT 1 |
### Instruction:
what's the first value of the arterial bp [diastolic] of patient 4269?
### Response:
| SELECT 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 = 4269)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp [diastolic]' AND d_items.linksto = 'chartevents') ORDER BY chartevents.charttime LIMIT 1 |
### Instruction:
how many days has it been since patient 006-124193's first bedside glucose lab test during their current hospital encounter?
### Response:
| SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', 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 = '006-124193' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = 'bedside glucose' ORDER BY lab.labresulttime LIMIT 1 |
### Instruction:
how many times does patient 015-20584 produce hemovac #1 since 03/30/2102?
### 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 = '015-20584')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput.celllabel = 'hemovac #1' AND STRFTIME('%y-%m-%d', intakeoutput.intakeoutputtime) >= '2102-03-30' |
### Instruction:
how many times did patient 95280 had received a inser temp pacemaker sys last year?
### 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 = 'inser temp pacemaker sys') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 95280) AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') |
### Instruction:
Next semester , who teaches INTLSTD 370 ?
### Response:
| SELECT DISTINCT instructor.name FROM instructor INNER JOIN offering_instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN course_offering ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN course ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE course.department = 'INTLSTD' AND course.number = 370 AND semester.semester = 'FA' AND semester.year = 2016 |
### Instruction:
what is the total dose of sc 24 fe ng that patient 6170 received on the current intensive care unit visit?
### Response:
| 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 = 6170) AND icustays.outtime IS NULL) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'sc 24 fe ng' AND d_items.linksto = 'inputevents_cv') |
### Instruction:
what's patient 27362's maximum value of bicarbonate in 06/last year?
### Response:
| SELECT MAX(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 27362) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'bicarbonate') AND DATETIME(labevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', labevents.charttime) = '06' |
### Instruction:
what was the first procedure time of patient 41393 for spinal tap until 2103?
### Response:
| SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'spinal tap') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 41393) AND STRFTIME('%y', procedures_icd.charttime) <= '2103' ORDER BY procedures_icd.charttime LIMIT 1 |
### Instruction:
what was the top three of the most frequent procedures during this 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 DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY procedures_icd.icd9_code) AS t1 WHERE t1.c1 <= 3) |
### Instruction:
iPhone thread volume, page views, unique OPs by month.
### Response:
| SELECT COUNT(*) AS Volume, SUM(ViewCount) AS PageViews, COUNT(DISTINCT OwnerUserId) AS UniqueOPs, TIME_TO_STR(P.CreationDate, '%Y') AS "year", TIME_TO_STR(P.CreationDate, '%m') AS Month FROM Posts AS P WHERE ('tags' LIKE '%<iphone%') AND PostTypeId = 1 AND CommunityOwnedDate IS NULL AND ClosedDate IS NULL GROUP BY TIME_TO_STR(P.CreationDate, '%YEAR'), TIME_TO_STR(P.CreationDate, '%-mONT%-H') ORDER BY 'year', Month |
### Instruction:
Google app engine thread volume with accepted answers by month.
### Response:
| SELECT COUNT(*) AS AnsweredVolume, TIME_TO_STR(P.CreationDate, '%Y') AS "year", TIME_TO_STR(P.CreationDate, '%m') AS Month FROM Posts AS P WHERE (Tags LIKE '%<google-app-engine>%' OR Tags LIKE '%<google-app-engine-patch>%') AND PostTypeId = 1 AND CommunityOwnedDate IS NULL AND ClosedDate IS NULL AND AcceptedAnswerId > 0 GROUP BY TIME_TO_STR(P.CreationDate, '%YEAR'), TIME_TO_STR(P.CreationDate, '%-mONT%-H') ORDER BY 'year', Month |
### Instruction:
No Thanks III: The Revenge.
### Response:
| SELECT Id AS "post_link", Body FROM Posts WHERE LOWER(Body) LIKE '%regards%' OR LOWER(Body) LIKE '%greetings%' OR LOWER(Body) LIKE '%tanks in%' OR LOWER(Body) LIKE '%i need%help%' OR LOWER(Body) LIKE '%i need%halp%' OR LOWER(Body) LIKE '%hi %' OR LOWER(Body) LIKE 'guys%' OR LOWER(Body) LIKE '%hello%' OR LOWER(Body) LIKE '%good morning%' OR LOWER(Body) LIKE '%good day%' OR LOWER(Body) LIKE '%good afternoon%' LIMIT 1000 |
### Instruction:
Overall site activity per hour.
### Response:
| SELECT h.hours AS "hour", COUNT(postsCounter) AS "posts" FROM (SELECT TIME_TO_STR(CreationDate, '%h') AS active, 1 AS counter, 1 AS postsCounter, NULL AS commentsCounter, NULL AS editsCounter, NULL AS suggestedCounter FROM Votes WHERE VoteTypeId = 1 AND TIME_TO_STR(CreationDate, '%Y') >= 2013) AS a RIGHT JOIN (SELECT DISTINCT TIME_TO_STR(CreationDate, '%h') AS hours FROM Votes WHERE VoteTypeId = 1) AS h ON a.active = h.hours GROUP BY h.hours ORDER BY h.hours |
### Instruction:
Top users in Sri Lanka in Scala.
### Response:
| SELECT ROW_NUMBER() OVER (ORDER BY U.Reputation DESC, U.Age) AS "#", U.Id AS "user_link", U.Age, U.Location, U.Reputation, U.UpVotes, U.DownVotes FROM Users AS U WHERE U.Id IN (SELECT DISTINCT U.Id FROM Users AS U INNER JOIN Posts AS P ON U.Id = P.OwnerUserId INNER JOIN PostTags AS PT ON PT.PostId = P.Id INNER JOIN Tags AS T ON T.Id = PT.TagId WHERE LOWER(U.Location) LIKE '%sri lanka%' AND LOWER(T.TagName) LIKE 'scala%') |
### Instruction:
did patient 002-3736's respiration ever greater than 24.0 a month before.
### Response:
| SELECT COUNT(*) > 0 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-3736')) AND vitalperiodic.respiration > 24.0 AND NOT vitalperiodic.respiration IS NULL AND DATETIME(vitalperiodic.observationtime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') |
### Instruction:
what was the name of the intake that patient 017-83061 until 943 days ago last had?
### Response:
| SELECT intakeoutput.celllabel FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-83061')) AND intakeoutput.cellpath LIKE '%intake%' AND DATETIME(intakeoutput.intakeoutputtime) <= DATETIME(CURRENT_TIME(), '-943 day') ORDER BY intakeoutput.intakeoutputtime DESC LIMIT 1 |
### Instruction:
Questions and Answers per month.
### Response:
| SELECT DATEADD(month, DATEDIFF(month, @start, CreationDate), @start) AS "month", SUM(CASE WHEN PostTypeId = 1 THEN 1 ELSE 0 END) AS "questions", SUM(CASE WHEN PostTypeId = 2 THEN 1 ELSE 0 END) AS "answers" FROM Posts WHERE (PostTypeId = 1 OR PostTypeId = 2) AND CreationDate >= @start AND CreationDate < @stop AND Score = 0 GROUP BY DATEADD(month, DATEDIFF(month, @start, CreationDate), @start) ORDER BY DATEADD(month, DATEDIFF(month, @start, CreationDate), @start) |