instruction
stringlengths
37
754
output
stringlengths
9
3.43k
### Instruction: when was the last time patient 027-178044 heartrate was measured greater than 86.0 until 01/18/2105. ### 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 = '027-178044')) AND vitalperiodic.heartrate > 86.0 AND NOT vitalperiodic.heartrate IS NULL AND STRFTIME('%y-%m-%d', vitalperiodic.observationtime) <= '2105-01-18' ORDER BY vitalperiodic.observationtime DESC LIMIT 1
### Instruction: what is the name of the treatment which has been given to patient 025-27850 two or more times in the previous month? ### 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 = '025-27850')) AND DATETIME(treatment.treatmenttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 >= 2
### Instruction: Users with at least 'minAnswers' answers, all scoring at least 'minScore'. ### Response:
SELECT uu.Id AS "user_link", aCt.aCt AS NumAnswers FROM Users AS uu INNER JOIN (SELECT uuu.Id, COUNT(*) AS aCt FROM Posts AS pp INNER JOIN Users AS uuu ON pp.OwnerUserId = uuu.Id WHERE pp.PostTypeId = 2 GROUP BY uuu.Id) AS aCt ON uu.Id = aCt.Id WHERE uu.Id NOT IN (SELECT u.Id FROM Posts AS p INNER JOIN Users AS u ON p.OwnerUserId = u.Id WHERE p.Score >= '##minScore##' AND p.PostTypeId = 2) AND aCt.aCt >= '##minAnswers##'
### Instruction: i would like information on flights leaving from WASHINGTON 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 = 'WASHINGTON' 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
### Instruction: Find the first and last name of the staff members who reported problems from the product 'rem' but not 'aut'? ### Response:
SELECT T3.staff_first_name, T3.staff_last_name FROM problems AS T1 JOIN product AS T2 JOIN staff AS T3 ON T1.product_id = T2.product_id AND T1.reported_by_staff_id = T3.staff_id WHERE T2.product_name = "rem" EXCEPT SELECT T3.staff_first_name, T3.staff_last_name FROM problems AS T1 JOIN product AS T2 JOIN staff AS T3 ON T1.product_id = T2.product_id AND T1.reported_by_staff_id = T3.staff_id WHERE T2.product_name = "aut"
### Instruction: had patient 005-12192 had a antiarrhythmics - class ii antiarrhythmic procedure in another hospital this year? ### Response:
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '005-12192' AND patient.hospitalid <> (SELECT DISTINCT patient.hospitalid FROM patient WHERE patient.uniquepid = '005-12192' AND patient.hospitaldischargetime IS NULL)) AND treatment.treatmentname = 'antiarrhythmics - class ii antiarrhythmic' AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
### Instruction: what's the average cost of a hospital with dexmedetomidine 200 mcg in 50 ml ns during this year? ### Response:
SELECT AVG(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 = 'dexmedetomidine 200 mcg in 50 ml ns')) AND DATETIME(cost.chargetime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY cost.patienthealthsystemstayid) AS t1
### Instruction: how do i get from BOSTON 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 = 'BOSTON' 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 was patient 16169's last heart rate until 1239 days ago. ### 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 = 16169)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'heart rate' AND d_items.linksto = 'chartevents') AND DATETIME(chartevents.charttime) <= DATETIME(CURRENT_TIME(), '-1239 day') ORDER BY chartevents.charttime DESC LIMIT 1
### Instruction: count the number of patients who had undergone a below knee amputat nec procedure two or more times until 2101. ### 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 = 'below knee amputat nec') AND STRFTIME('%y', procedures_icd.charttime) <= '2101' GROUP BY admissions.subject_id) AS t1 WHERE t1.c1 >= 2
### Instruction: Question Score June 2012, with Vote Creation Date. ### Response:
SELECT SUM(CASE Votes.VoteTypeId WHEN 2 THEN 1 ELSE 0 END) - SUM(CASE Votes.VoteTypeId WHEN 3 THEN 1 ELSE 0 END) AS score, Users.DisplayName FROM Posts INNER JOIN Users ON Users.Id = Posts.OwnerUserId INNER JOIN Votes ON Votes.PostId = Posts.Id WHERE PostTypeId = 1 AND Posts.CreationDate BETWEEN '2012-06-01' AND '2012-06-30' AND Votes.CreationDate BETWEEN '2012-06-01' AND '2012-06-30' GROUP BY Users.DisplayName ORDER BY Score DESC
### Instruction: what was the name of the specimen test patient 031-1337 received in 05/this year for the first time? ### Response:
SELECT microlab.culturesite FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-1337')) AND DATETIME(microlab.culturetakentime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', microlab.culturetakentime) = '05' ORDER BY microlab.culturetakentime LIMIT 1
### Instruction: Mean rep gained by answers by count of earlier answers. ### Response:
WITH PostNo AS (SELECT Id AS PostId, RANK() OVER (PARTITION BY ParentId ORDER BY Id) AS N FROM Posts WHERE NOT ParentId IS NULL), VoteRep AS (SELECT 1 AS VoteTypeId, 15 AS Rep UNION SELECT 2, 10 UNION SELECT 3, -2), Raw AS (SELECT PostNo.PostId, SUM(VoteRep.Rep) AS Rep, MIN(PostNo.N) AS N FROM PostNo, Votes, VoteRep WHERE Votes.PostId = PostNo.PostId AND VoteRep.VoteTypeId = Votes.VoteTypeId GROUP BY PostNo.PostId) SELECT N, COUNT(*) AS Count, AVG(1.0 * Rep) AS Rep FROM Raw GROUP BY N ORDER BY N
### Instruction: when patient 025-44495 had their first sputum, tracheal specimen microbiology test in this month? ### Response:
SELECT microlab.culturetakentime FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-44495')) AND microlab.culturesite = 'sputum, tracheal specimen' AND DATETIME(microlab.culturetakentime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') ORDER BY microlab.culturetakentime LIMIT 1
### Instruction: Delay between question and answer in answered questions for Beam / Dataflow. ### Response:
SELECT Questions.Id AS "Question", Questions.CreationDate AS "QuestionDate", COUNT(Answers.Id) AS "AnswerCount", MIN(Answers.CreationDate) AS "QuickestAnswerDate", CAST((JULIANDAY(MIN(Answers.CreationDate)) - JULIANDAY(Questions.CreationDate)) * 86400.0 AS INT) / 3600.0 AS "Delay" FROM Posts AS Questions INNER JOIN Posts AS Answers ON Answers.ParentId = Questions.Id WHERE (Questions.Tags LIKE '%apache-beam%' OR Questions.Tags LIKE '%google-cloud-dataflow%') GROUP BY Questions.Id, Questions.CreationDate
### Instruction: what was the new drug of patient 23436 today compared to that yesterday? ### Response:
SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 23436) AND DATETIME(prescriptions.startdate, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 23436) AND DATETIME(prescriptions.startdate, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-1 day')
### Instruction: when is the first time patient 027-135082 during the last year received therapeutic antibacterials - aminoglycoside. ### 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 = '027-135082')) AND treatment.treatmentname = 'therapeutic antibacterials - aminoglycoside' AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY treatment.treatmenttime LIMIT 1
### Instruction: how many times has patient 7698 produced a nasogastric output in 11/this year? ### Response:
SELECT COUNT(*) 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 = 7698)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'nasogastric' AND d_items.linksto = 'outputevents') AND DATETIME(outputevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', outputevents.charttime) = '11'
### Instruction: At what times of the week will 131 be offered ? ### Response:
SELECT DISTINCT course_offering.end_time, course_offering.friday, course_offering.monday, course_offering.saturday, course_offering.start_time, course_offering.sunday, course_offering.thursday, course_offering.tuesday, course_offering.wednesday FROM semester INNER JOIN course_offering ON semester.semester_id = course_offering.semester INNER JOIN course ON course.course_id = course_offering.course_id WHERE course.department = 'EECS' AND course.number = 131 AND semester.semester = 'FA' AND semester.year = 2016
### Instruction: what is the red blood cells percentile of 3.88 among patients of the same age as patient 27146 in the current 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 = 'red blood cells') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age = (SELECT admissions.age FROM admissions WHERE admissions.subject_id = 27146 AND admissions.dischtime IS NULL))) AS t1 WHERE t1.valuenum = 3.88
### Instruction: UpVote DownVote Year Voted Year Posted Total Count - Questions. ### Response:
SELECT 'Questions' AS "post_type", vt.Name, YEAR(p.CreationDate) AS "post_year", YEAR(v.CreationDate) AS "vote_year", COUNT(v.Id) AS "total_count" FROM Votes AS v INNER JOIN VoteTypes AS vt ON v.VoteTypeId = vt.Id INNER JOIN Posts AS p ON v.PostId = p.Id WHERE p.PostTypeId = 1 AND p.DeletionDate IS NULL AND vt.Name IN ('UpMod', 'DownMod') AND p.AcceptedAnswerId IS NULL AND p.AnswerCount > 0 GROUP BY vt.Name, YEAR(p.CreationDate), YEAR(v.CreationDate)
### Instruction: what is the percentile of 1.1 in a creatinine lab test that given the same age of patient 25814 in this 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 = 'creatinine') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age = (SELECT admissions.age FROM admissions WHERE admissions.subject_id = 25814 AND admissions.dischtime IS NULL))) AS t1 WHERE t1.valuenum = 1.1
### Instruction: what flights go from SAN FRANCISCO to 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 = 'SAN FRANCISCO' 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
### Instruction: what was the organism found in patient 025-19271's last microbiology test of the urine, catheter specimen until 09/2105? ### 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 = '025-19271')) AND microlab.culturesite = 'urine, catheter specimen' AND STRFTIME('%y-%m', microlab.culturetakentime) <= '2105-09' ORDER BY microlab.culturetakentime DESC LIMIT 1
### Instruction: what is the percentile of 874.0 in a alt (sgpt) lab test that given the same age of patient 015-21757 on the last hospital encounter? ### Response:
SELECT DISTINCT t1.c1 FROM (SELECT lab.labresult, PERCENT_RANK() OVER (ORDER BY lab.labresult) AS c1 FROM lab WHERE lab.labname = 'alt (sgpt)' AND lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age = (SELECT patient.age FROM patient WHERE patient.uniquepid = '015-21757' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1))) AS t1 WHERE t1.labresult = 874.0
### Instruction: i want to go from SAN FRANCISCO 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 = 'SAN FRANCISCO' 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
### Instruction: What teacher taught Pamela Campbell when he took PAT 513 ? ### Response:
SELECT DISTINCT instructor.name FROM instructor INNER JOIN offering_instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN student_record ON student_record.offering_id = offering_instructor.offering_id INNER JOIN student ON student.student_id = student_record.student_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 WHERE course.department = 'PAT' AND course.number = 513 AND student.firstname LIKE 'Pamela' AND student.lastname LIKE 'Campbell'
### Instruction: Should we be notified if an answer to a question we asked has a higher score than the accepted answe. https://meta.stackoverflow.com/questions/371621/should-we-be-notified-if-an-answer-to-a-question-we-asked-has-a-higher-score-tha ### Response:
SELECT q.Id FROM Posts AS q INNER JOIN Posts AS acc ON acc.Id = q.AcceptedAnswerId LEFT OUTER JOIN Posts AS a ON a.ParentId = q.Id AND a.Id != acc.Id WHERE q.PostTypeId = 1 AND NOT q.AcceptedAnswerId IS NULL AND q.OwnerUserId = '##userid:int?160527##' GROUP BY q.Id HAVING MIN(acc.Score) < MAX(a.Score)
### Instruction: Getting Python DS related content. ### Response:
SELECT Id, Score, ViewCount, Title, Tags, CommentCount, FavoriteCount FROM Posts WHERE PostTypeId = 1 AND DeletionDate IS NULL AND (Tags LIKE '%python%' OR Tags LIKE '%sql%' OR Tags LIKE '%numpy%' OR Tags LIKE '%scikit-learn%' OR Tags LIKE '%sklearn%' OR Tags LIKE '%numpy%' OR Tags LIKE '%scipy%' OR Tags LIKE '%pandas%' OR (Tags LIKE '%xgboost%' AND Tags LIKE '%python%') OR (Tags LIKE '%catboost%' AND Tags LIKE '%python%') OR (Tags LIKE '%prophet%' AND Tags LIKE '%python%') OR (Tags LIKE '%spark%' AND Tags LIKE '%python%') OR (Tags LIKE '%machine-learning%' AND Tags LIKE '%python%') OR (Tags LIKE '%probability%' AND Tags LIKE '%python%'))
### Instruction: i need a flight from PHILADELPHIA to 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 = 'PHILADELPHIA' 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
### 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: show flights from PHILADELPHIA to 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 = 'PHILADELPHIA' 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
### 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: Which of the courses that I 've taken is considered the hardest ? ### 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 program_course.workload = (SELECT MAX(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 INNER JOIN student_record AS STUDENT_RECORDalias1 ON STUDENT_RECORDalias1.course_id = PROGRAM_COURSEalias1.course_id WHERE STUDENT_RECORDalias1.student_id = 1) AND student_record.student_id = 1
### 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: BALTIMORE 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 = 'BALTIMORE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILADELPHIA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
### Instruction: what is the percentile of 874.0 in alt (sgpt) given the same age of patient 015-21757 when they came to the hospital last time? ### Response:
SELECT DISTINCT t1.c1 FROM (SELECT lab.labresult, PERCENT_RANK() OVER (ORDER BY lab.labresult) AS c1 FROM lab WHERE lab.labname = 'alt (sgpt)' AND lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age = (SELECT patient.age FROM patient WHERE patient.uniquepid = '015-21757' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1))) AS t1 WHERE t1.labresult = 874.0
### Instruction: Questions and accepted answers are both first-posts. ### Response:
WITH Raw AS (SELECT MIN(Id) AS Id FROM Posts WHERE OwnerUserId > 0 GROUP BY OwnerUserId) SELECT Q.Id AS "post_link", * FROM Posts AS Q, Posts AS A WHERE Q.AcceptedAnswerId = A.Id AND Q.Id IN (SELECT Id FROM Raw) AND A.Id IN (SELECT Id FROM Raw) AND Q.OwnerUserId > 0 AND A.OwnerUserId > 0 AND Q.OwnerUserId != A.OwnerUserId AND Q.Score > 0 AND A.Score > 0 AND Q.CommunityOwnedDate IS NULL AND A.CommunityOwnedDate IS NULL AND NOT Q.ClosedDate IS NULL ORDER BY Q.Score + A.Score DESC, Q.Id LIMIT 100
### Instruction: i'd like a return flight from BALTIMORE to 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 = 'BALTIMORE' 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
### Instruction: Top SO iOS users in krakow.. ### Response:
SELECT DisplayName AS "display_name", Users.Id AS "user_link", SUM(CASE Votes.VoteTypeId WHEN 2 THEN 1 WHEN 3 THEN -1 END) AS Score FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts ON Posts.ParentId = PostTags.PostId INNER JOIN Users ON Posts.OwnerUserId = Users.Id INNER JOIN Votes ON Votes.PostId = Posts.Id WHERE (LOWER(Location) LIKE '%krak%' OR LOWER(Location) LIKE '%cracow%') AND (Tags.TagName = 'ios' OR Tags.TagName = 'objective-c' OR Tags.TagName = 'swift') AND Reputation > 10 GROUP BY DisplayName, Users.Id ORDER BY Score DESC
### Instruction: what is the minimum value of sao2 of patient 007-2001 on 01/22/last year? ### Response:
SELECT MIN(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 = '007-2001')) AND NOT vitalperiodic.sao2 IS NULL AND DATETIME(vitalperiodic.observationtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m-%d', vitalperiodic.observationtime) = '01-22'
### Instruction: show me the flights from OAKLAND 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 = 'OAKLAND' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WASHINGTON' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
### Instruction: please list the flights from WASHINGTON to ATLANTA ### 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 = 'ATLANTA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
### Instruction: Get all questions and answerers from tag. ### Response:
SELECT p.Id, p.CreationDate, p.Score, p.ViewCount, p.Title, p.AnswerCount, p.CommentCount, p.FavoriteCount, u.DisplayName AS quest_name, u.Reputation AS quest_rep, u2.DisplayName AS ans_name, u2.Reputation AS ans_rep FROM Posts AS p JOIN PostTags AS pt ON p.Id = pt.PostId JOIN Tags AS t ON pt.TagId = t.Id LEFT JOIN Posts AS ans ON p.AcceptedAnswerId = ans.Id LEFT JOIN Users AS u ON p.OwnerUserId = u.Id LEFT JOIN Users AS u2 ON ans.OwnerUserId = u2.Id WHERE t.TagName = 'pandas' AND p.CreationDate <= '2020'
### Instruction: what was the total amount of output for patient 002-35416 on 05/06/last year? ### 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 = '002-35416')) AND intakeoutput.cellpath LIKE '%output%' AND DATETIME(intakeoutput.intakeoutputtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m-%d', intakeoutput.intakeoutputtime) = '05-06'
### Instruction: when was the last time patient 031-23605 got their urine, catheter specimen microbial testing until 08/2104? ### Response:
SELECT microlab.culturetakentime FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-23605')) AND microlab.culturesite = 'urine, catheter specimen' AND STRFTIME('%y-%m', microlab.culturetakentime) <= '2104-08' ORDER BY microlab.culturetakentime DESC LIMIT 1
### Instruction: what is the total potassium intake until 12/05/2102 that patient 3677 has received? ### 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 = 3677)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'potassium' AND d_items.linksto = 'inputevents_cv') AND STRFTIME('%y-%m-%d', inputevents_cv.charttime) <= '2102-12-05'
### Instruction: what was the name of the organism found in the last blood, venipuncture microbiology test of patient 031-3355 in this month? ### 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-3355')) AND microlab.culturesite = 'blood, venipuncture' AND DATETIME(microlab.culturetakentime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') ORDER BY microlab.culturetakentime DESC LIMIT 1
### Instruction: what are the 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: Find the names of customers who ordered both products Latte and Americano. ### Response:
SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id JOIN products AS t4 ON t3.product_id = t4.product_id WHERE t4.product_details = 'Latte' INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id JOIN products AS t4 ON t3.product_id = t4.product_id WHERE t4.product_details = 'Americano'
### Instruction: show flights 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 = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILADELPHIA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
### Instruction: what was patient 035-4312's intake for the first time on this month/26? ### 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 = '035-4312')) AND intakeoutput.cellpath LIKE '%intake%' AND DATETIME(intakeoutput.intakeoutputtime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') AND STRFTIME('%d', intakeoutput.intakeoutputtime) = '26' ORDER BY intakeoutput.intakeoutputtime LIMIT 1
### Instruction: how much did patient 13837 weigh first measured since 166 months ago? ### 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 = 13837)) 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(), '-166 month') ORDER BY chartevents.charttime LIMIT 1
### Instruction: what is the total amount of d5/.45ns given to patient 25733 today? ### 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 = 25733)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'd5/.45ns' AND d_items.linksto = 'inputevents_cv') AND DATETIME(inputevents_cv.charttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day')
### Instruction: there were any organism found in patient 031-15666's first urine, catheter specimen microbiology test the previous year? ### Response:
SELECT COUNT(*) > 0 FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-15666')) AND microlab.culturesite = 'urine, catheter specimen' AND DATETIME(microlab.culturetakentime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY microlab.culturetakentime LIMIT 1
### Instruction: when was the first time patient 012-20116 had urine catheter output since 12/29/2103? ### 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 = '012-20116')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput.celllabel = 'urine catheter' AND STRFTIME('%y-%m-%d', intakeoutput.intakeoutputtime) >= '2103-12-29' ORDER BY intakeoutput.intakeoutputtime LIMIT 1
### Instruction: get flights from TORONTO to MILWAUKEE ### 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 = 'TORONTO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MILWAUKEE' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
### Instruction: what was the name of the organism that was found on the first blood, venipuncture microbiology test patient 031-16123 received since 09/2104? ### 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-16123')) AND microlab.culturesite = 'blood, venipuncture' AND STRFTIME('%y-%m', microlab.culturetakentime) >= '2104-09' ORDER BY microlab.culturetakentime LIMIT 1
### Instruction: count the number of patients who had the intake of volume (ml)-antithrombin iii (human) (thrombate iii) 550 units in sterile iv diluent 11 ml infusion syringe since 6 years ago. ### Response:
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT intakeoutput.patientunitstayid FROM intakeoutput WHERE intakeoutput.celllabel = 'volume (ml)-antithrombin iii (human) (thrombate iii) 550 units in sterile iv diluent 11 ml infusion syringe' AND intakeoutput.cellpath LIKE '%input%' AND DATETIME(intakeoutput.intakeoutputtime) >= DATETIME(CURRENT_TIME(), '-6 year'))
### Instruction: In the Winter , when does 890 meet ? ### Response:
SELECT DISTINCT course_offering.end_time, course_offering.friday, course_offering.monday, course_offering.saturday, course_offering.start_time, course_offering.sunday, course_offering.thursday, course_offering.tuesday, course_offering.wednesday FROM semester INNER JOIN course_offering ON semester.semester_id = course_offering.semester INNER JOIN course ON course.course_id = course_offering.course_id WHERE course.department = 'EECS' AND course.number = 890 AND semester.semester = 'Winter' AND semester.year = 2016
### Instruction: Questions that are closed, excluding duplicates. Questions that are likely to need some delete votes. Duplicates should be left alone for the most part, so these are right out. ### Response:
SELECT p.Id AS "post_link", CASE h.Comment WHEN '2' THEN 'off topic' WHEN '3' THEN 'not constructive' WHEN '4' THEN 'not a real question' WHEN '7' THEN 'too localized' WHEN '10' THEN 'general reference' WHEN '20' THEN 'noise' ELSE h.Comment END AS Reason FROM Posts AS p INNER JOIN PostHistory AS h ON h.PostId = p.Id AND h.CreationDate = p.ClosedDate WHERE p.PostTypeId = 1 AND NOT p.ClosedDate IS NULL AND h.PostHistoryTypeId = 10 AND h.Comment != 1
### Instruction: what flights from INDIANAPOLIS to MEMPHIS ### 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 = 'INDIANAPOLIS' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MEMPHIS' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
### Instruction: show all flights PHILADELPHIA to 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 = 'PHILADELPHIA' 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
### Instruction: what was the average daily number of patients diagnosed with acq pyloric stenosis in this year? ### 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 = 'acq pyloric stenosis') AND DATETIME(diagnoses_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY STRFTIME('%y-%m-%d', diagnoses_icd.charttime)) AS t1
### Instruction: is normal for patient 4401's sao2 on the last icu visit? ### 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 = 4401) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime DESC LIMIT 1) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'sao2' AND d_items.linksto = 'chartevents') AND chartevents.valuenum BETWEEN sao2_lower AND sao2_upper
### Instruction: show me the flights from BALTIMORE 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 = 'BALTIMORE' 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: list flights from MILWAUKEE to DETROIT ### 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 = 'MILWAUKEE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DETROIT' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
### Instruction: how many times in their first hospital visit ipratropium-albuterol 0.5-2.5 (3) mg/3ml in soln was prescribed for patient 018-20179? ### Response:
SELECT COUNT(*) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '018-20179' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1)) AND medication.drugname = 'ipratropium-albuterol 0.5-2.5 (3) mg/3ml in soln'
### Instruction: what was patient 1912 first diagnosis time of peritoneal abscess during the previous year. ### 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 = 'peritoneal abscess') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1912) AND DATETIME(diagnoses_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY diagnoses_icd.charttime LIMIT 1
### Instruction: what's the first prescription time for famotidine (pepcid) (2 mg/ml) inj dilution 20 mg for patient 021-100763 during their current hospital encounter? ### 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 = '021-100763' AND patient.hospitaldischargetime IS NULL)) AND medication.drugname = 'famotidine (pepcid) (2 mg/ml) inj dilution 20 mg' ORDER BY medication.drugstarttime LIMIT 1
### Instruction: list flights 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 = 'DALLAS' 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: What course would be the most difficult of the courses I 've taken ? ### 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 program_course.workload = (SELECT MAX(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 INNER JOIN student_record AS STUDENT_RECORDalias1 ON STUDENT_RECORDalias1.course_id = PROGRAM_COURSEalias1.course_id WHERE STUDENT_RECORDalias1.student_id = 1) AND student_record.student_id = 1
### Instruction: i mean how many hours has it been since the first time patient 004-79017 had a ns 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 = '004-79017') AND patient.unitdischargetime IS NULL) AND intakeoutput.celllabel = 'ns' AND intakeoutput.cellpath LIKE '%intake%' ORDER BY intakeoutput.intakeoutputtime LIMIT 1
### Instruction: i would like to travel from INDIANAPOLIS to HOUSTON ### 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 = 'INDIANAPOLIS' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'HOUSTON' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
### 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: Ben Craig took EARTH 586 , taught by which professor ? ### Response:
SELECT DISTINCT instructor.name FROM instructor INNER JOIN offering_instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN student_record ON student_record.offering_id = offering_instructor.offering_id INNER JOIN student ON student.student_id = student_record.student_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 WHERE course.department = 'EARTH' AND course.number = 586 AND student.firstname LIKE 'Ben' AND student.lastname LIKE 'Craig'
### Instruction: how many times in 05/last year did patient 1903 produce a tf residual output? ### Response:
SELECT COUNT(*) 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 = 1903)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'tf residual' AND d_items.linksto = 'outputevents') AND DATETIME(outputevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', outputevents.charttime) = '05'
### Instruction: what is the daily maximum dose of iv other given to patient 028-43966 since 93 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 = '028-43966')) AND intakeoutput.celllabel = 'iv other' AND intakeoutput.cellpath LIKE '%intake%' AND DATETIME(intakeoutput.intakeoutputtime) >= DATETIME(CURRENT_TIME(), '-93 month') GROUP BY STRFTIME('%y-%m-%d', intakeoutput.intakeoutputtime)
### Instruction: when is the first time that patient 14671 has the maximum arterial bp mean value on the current icu visit? ### Response:
SELECT chartevents.charttime 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 = 14671) AND icustays.outtime IS NULL) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp mean' AND d_items.linksto = 'chartevents') ORDER BY chartevents.valuenum DESC, chartevents.charttime LIMIT 1
### Instruction: when was the last time in this year patient 2489 had received a periph nerve transposit? ### 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 = 'periph nerve transposit') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 2489) AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') ORDER BY procedures_icd.charttime DESC LIMIT 1
### Instruction: what was patient 17435's first arterial bp mean on the first intensive care unit 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 = 17435) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp mean' AND d_items.linksto = 'chartevents') ORDER BY chartevents.charttime LIMIT 1
### Instruction: how many hours has it been since patient 030-42006's first hepatic encephalopathy diagnosis in the current hospital visit? ### Response:
SELECT 24 * (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 = '030-42006' AND patient.hospitaldischargetime IS NULL)) AND diagnosis.diagnosisname = 'hepatic encephalopathy' ORDER BY diagnosis.diagnosistime LIMIT 1
### Instruction: Orphan questions that were migrated from another site and may be self-answered. Questions that were migrated and have no owner, and that have an answer from a registered user with the same name. ### Response:
SELECT q.Id AS "post_link", q.CreationDate AS "date", q.OwnerDisplayName AS "user_name", a.OwnerUserId AS "user_link", ph.Comment AS "comment" FROM Posts AS q INNER JOIN PostHistory AS ph ON ph.PostId = q.Id INNER JOIN Posts AS a ON a.ParentId = q.Id AND a.OwnerDisplayName = q.OwnerDisplayName WHERE ph.PostHistoryTypeId = 17 AND q.PostTypeId = 1 AND q.OwnerUserId IS NULL AND NOT a.OwnerUserId IS NULL ORDER BY q.Id DESC LIMIT 1000
### Instruction: what is the average daily number of patients who have had hemangioma intracranial during the last year? ### 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 = 'hemangioma intracranial') AND DATETIME(diagnoses_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY STRFTIME('%y-%m-%d', diagnoses_icd.charttime)) AS t1
### Instruction: What is the weekly schedule for 418 ? ### Response:
SELECT DISTINCT course_offering.end_time, course_offering.friday, course_offering.monday, course_offering.saturday, course_offering.start_time, course_offering.sunday, course_offering.thursday, course_offering.tuesday, course_offering.wednesday FROM semester INNER JOIN course_offering ON semester.semester_id = course_offering.semester INNER JOIN course ON course.course_id = course_offering.course_id WHERE course.department = 'EECS' AND course.number = 418 AND semester.semester = 'FA' AND semester.year = 2016
### Instruction: what is patient 004-32341's last sao2 on this month/09? ### Response:
SELECT 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 = '004-32341')) AND NOT vitalperiodic.sao2 IS NULL AND DATETIME(vitalperiodic.observationtime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') AND STRFTIME('%d', vitalperiodic.observationtime) = '09' ORDER BY vitalperiodic.observationtime DESC LIMIT 1
### Instruction: Of all the courses I have completed , which was the most difficult ? ### 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 program_course.workload = (SELECT MAX(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 INNER JOIN student_record AS STUDENT_RECORDalias1 ON STUDENT_RECORDalias1.course_id = PROGRAM_COURSEalias1.course_id WHERE STUDENT_RECORDalias1.student_id = 1) AND student_record.student_id = 1
### Instruction: show me all the flights from DENVER 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 = 'DENVER' 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: on the first icu visit what is the minimum arterial bp [diastolic] of patient 18742? ### 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 = 18742) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime 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')
### Instruction: What 's easier out of these two : EECS 101 or EECS 510 ? ### Response:
SELECT DISTINCT course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE (course.number = 101 OR course.number = 510) 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 = 101 OR COURSEalias1.number = 510) AND COURSEalias1.department = 'EECS')
### Instruction: tell me the last specimen test that patient 025-19271 received in 09/this year? ### Response:
SELECT microlab.culturesite FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-19271')) AND DATETIME(microlab.culturetakentime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', microlab.culturetakentime) = '09' ORDER BY microlab.culturetakentime DESC LIMIT 1
### Instruction: Of all the classes Dr. Anne Murphy has taught in the past what were the subjects ? ### Response:
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor WHERE course_offering.semester < (SELECT SEMESTERalias0.semester_id FROM semester AS SEMESTERalias0 WHERE SEMESTERalias0.semester = 'WN' AND SEMESTERalias0.year = 2016) AND course.course_id = course_offering.course_id AND instructor.name LIKE '%Anne Murphy%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id
### Instruction: flights from INDIANAPOLIS 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 = 'INDIANAPOLIS' 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: Of the classes I 've completed , which is considered most difficult ? ### 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 program_course.workload = (SELECT MAX(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 INNER JOIN student_record AS STUDENT_RECORDalias1 ON STUDENT_RECORDalias1.course_id = PROGRAM_COURSEalias1.course_id WHERE STUDENT_RECORDalias1.student_id = 1) AND student_record.student_id = 1
### Instruction: history or presence of any clinically relevant hematological, hepatic, respiratory, cardiovascular, renal, metabolic, endocrine, or cns disease or other medical conditions that are not well controlled, may put the subject at risk, could interfere with the objectives of the study, or make the subject unsuitable for participation in the study for any other reason in the opinion of the principal investigator. ### Response:
SELECT * FROM table_train_126 WHERE hematologic_disease = 1 OR hepatic_disease = 1 OR respiratory_rate = 1 OR cardiovascular_disease = 1 OR renal_disease = 1 OR metabolic = 1 OR endocrine_disease = 1 OR cns_disease = 1