instruction
stringlengths
37
754
output
stringlengths
9
3.43k
### Instruction: when they came to the hospital first time, glipizide, clonazepam or pantoprazole has been prescribed for patient 88404? ### Response:
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 88404 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) AND prescriptions.drug IN ('glipizide', 'clonazepam', 'pantoprazole')
### Instruction: what is when they came to the hospital first time minimum albumin value of patient 029-584? ### Response:
SELECT MIN(lab.labresult) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '029-584' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1)) AND lab.labname = 'albumin'
### Instruction: For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, show me the trend about employee_id over hire_date with a line chart, and rank by the X-axis in ascending. ### Response:
SELECT HIRE_DATE, EMPLOYEE_ID FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY HIRE_DATE
### Instruction: If I take 746 and 886 , can I leave at 5 ? ### Response:
SELECT COUNT(*) = 0 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.number = 746 OR course.number = 886) AND course_offering.end_time > '17:00:00' AND semester.semester = 'WN' AND semester.year = 2016
### Instruction: what is the average macrophages value until 08/2104 for patient 1798? ### Response:
SELECT AVG(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1798) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'macrophages') AND STRFTIME('%y-%m', labevents.charttime) <= '2104-08'
### Instruction: First badges of any kind. ### Response:
WITH FirstBadges AS (SELECT * FROM (SELECT UserId, Name, Date, Class, TagBased, ROW_NUMBER() OVER (PARTITION BY UserId, Name, Class ORDER BY Date) AS rn FROM Badges) AS b WHERE b.rn = 1) SELECT ROW_NUMBER() OVER (ORDER BY fb.Date) AS "#", fb.Name AS Name, fb.Class AS Class, fb.Date AS Date FROM FirstBadges AS fb WHERE fb.UserId = '##UserId##' ORDER BY fb.Date
### Instruction: Find answers by a given user to closed questions. ### Response:
SELECT a.ParentId AS "Question ID", a.Id AS "Answer ID", q.ClosedDate AS "Closed Date", ph.Comment AS "Closed Reason", q.Id AS "post_link" FROM Posts AS a JOIN Posts AS q ON a.ParentId = q.Id JOIN PostHistory AS ph ON ph.PostId = q.Id WHERE a.PostTypeId = 2 AND a.OwnerUserId = '##UserId:int##' AND ph.PostHistoryTypeId = 10 ORDER BY q.ClosedDate DESC
### Instruction: calculate the number of medicines that patient 022-158213 had been prescribed since 133 months ago. ### 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 = '022-158213')) AND DATETIME(medication.drugstarttime) >= DATETIME(CURRENT_TIME(), '-133 month')
### Instruction: what's the number of inputs patient 15447 has received 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 = 15447)) AND DATETIME(inputevents_cv.charttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day')
### Instruction: had patient 006-171217 received a laboratory test for -bands until 2104? ### Response:
SELECT COUNT(*) > 0 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-171217')) AND lab.labname = '-bands' AND STRFTIME('%y', lab.labresulttime) <= '2104'
### Instruction: What is the easiest class I can do to meet the MDE requirement ? ### Response:
SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%MDE%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 WHERE PROGRAM_COURSEalias1.category LIKE '%MDE%')
### Instruction: For the Directed Slavic Studies class , who taught it in the past , who is currently teaching it , and who will teach it in the future ? ### 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 WHERE course.name LIKE '%Directed Slavic Studies%'
### Instruction: Which To Par has Earnings ($) larger than 360,000, and a Year larger than 1998, and a Country of united states, and a Score of 69-68-66-64=267? ### Response:
SELECT "To Par" FROM table_79648 WHERE "Earnings ($)" > '360,000' AND "Year" > '1998' AND "Country" = 'united states' AND "Score" = '69-68-66-64=267'
### Instruction: For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the distribution of hire_date and the sum of manager_id bin hire_date by weekday in a bar chart, and order in desc by the Y-axis. ### Response:
SELECT HIRE_DATE, SUM(MANAGER_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SUM(MANAGER_ID) DESC
### Instruction: Next Winter , what special topics classes are being offered ? ### 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.number = 398 OR course.number = 498 OR course.number = 598) AND course.department = 'EECS' AND semester.semester = 'Winter' AND semester.year = 2017
### Instruction: Distribution of bounties over tags. ### Response:
SELECT TagName, COUNT(BountyAmount) AS nrOfBounties, SUM(BountyAmount) AS bountyHeight, AVG(BountyAmount) AS avgBounty FROM (SELECT VoteTypeId, BountyAmount, TagName FROM Votes AS v INNER JOIN PostTags AS m ON v.PostId = m.PostId INNER JOIN Tags AS t ON m.TagId = t.Id) AS P WHERE NOT BountyAmount IS NULL AND VoteTypeId = 8 GROUP BY TagName ORDER BY nrOfBounties DESC
### Instruction: In the next semester which classes are available as ULCS ? ### Response:
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program_course, semester WHERE course.course_id = course_offering.course_id AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016 GROUP BY course.department, course.number
### Instruction: Which professors have given PSYCH minors a B- in their class ? ### 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 WHERE (student_record.grade LIKE '%B-%' OR student_record.grade LIKE '%B-%') AND student.minor = 'PSYCH'
### Instruction: What is the average duration in 2007/08 with more than 3.8 in 2002/03, more than 8.9 in 2003/04, and less than 34.4 in 2001/02? ### Response:
SELECT AVG("2007/08") FROM table_64692 WHERE "2002/03" > '3.8' AND "2003/04" > '8.9' AND "2001/02" < '34.4'
### Instruction: have buprenorphine-naloxone (8mg-2mg) ever been prescribed to patient 18457 until 2103? ### Response:
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 18457) AND prescriptions.drug = 'buprenorphine-naloxone (8mg-2mg)' AND STRFTIME('%y', prescriptions.startdate) <= '2103'
### Instruction: For those employees who do not work in departments with managers that have ids between 100 and 200, a bar chart shows the distribution of hire_date and the sum of employee_id bin hire_date by time, and display total number from high to low order. ### Response:
SELECT HIRE_DATE, SUM(EMPLOYEE_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SUM(EMPLOYEE_ID) DESC
### Instruction: what is the number of patients whose procedure long title is excision or destruction of other lesion or tissue of heart, endovascular approach and lab test category is hematology? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE procedures.long_title = "Excision or destruction of other lesion or tissue of heart, endovascular approach" AND lab."CATEGORY" = "Hematology"
### Instruction: For those employees who do not work in departments with managers that have ids between 100 and 200, visualize a bar chart about the distribution of hire_date and the average of manager_id bin hire_date by time, and could you list y axis in ascending order? ### Response:
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(MANAGER_ID)
### Instruction: how many hours has it been since patient 82132's last stay in the careunit sicu in their current hospital visit? ### Response:
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', transfers.intime)) FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 82132 AND admissions.dischtime IS NULL) AND transfers.careunit = 'sicu' ORDER BY transfers.intime DESC LIMIT 1
### Instruction: For those employees who do not work in departments with managers that have ids between 100 and 200, visualize a bar chart about the distribution of hire_date and the average of department_id bin hire_date by weekday, and sort in ascending by the y axis. ### Response:
SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(DEPARTMENT_ID)
### Instruction: Find the names of stadiums that some Australian swimmers have been to, and count them by a bar chart, could you display total number in ascending order? ### Response:
SELECT T4.Name, COUNT(T4.Name) FROM swimmer AS t1 JOIN record AS t2 ON t1.ID = t2.Swimmer_ID JOIN event AS t3 ON t2.Event_ID = t3.ID JOIN stadium AS t4 ON t4.ID = t3.Stadium_ID WHERE t1.Nationality = 'Australia' GROUP BY T4.Name ORDER BY COUNT(T4.Name)
### Instruction: Percent of Questions with an Accepted Answer. ### Response:
SELECT questions.Id, COUNT(answerme.answerId) AS HasAcceptedAnswer FROM Posts AS questions LEFT JOIN (SELECT answers.ParentId AS answerId FROM Posts AS answers INNER JOIN Votes ON answers.Id = Votes.PostId WHERE Votes.VoteTypeId = 1) AS answerme ON answerme.answerId = questions.Id INNER JOIN PostTags ON questions.Id = PostTags.PostId INNER JOIN Tags ON PostTags.TagId = Tags.Id WHERE Tags.TagName = 'python' GROUP BY questions.Id ORDER BY RAND()
### Instruction: was there any medicine prescribed this year for patient 028-55503? ### Response:
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '028-55503')) AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
### Instruction: Does Political Sociology have only one teacher , Prof. Men ? ### Response:
SELECT DISTINCT course.department, course.name, course.number, instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.name LIKE '%Political Sociology%' AND NOT instructor.name LIKE '%Men%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id
### Instruction: All posts --answers tagged with X -- and Y. ### Response:
SELECT Posts.Id, '##invented:string##' AS invented FROM Posts, Tags AS invented, PostTags AS pti, Tags AS reinvented, PostTags AS ptri WHERE Posts.Id = pti.PostId AND Posts.Id = ptri.PostId AND pti.TagId = invented.Id AND ptri.TagId = reinvented.Id AND invented.TagName = '##invented:string##' AND reinvented.TagName = '##reinvented:string##'
### Instruction: a month before, when was the last time that patient 51177 was prescribed with a medication via sl route? ### Response:
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 51177) AND prescriptions.route = 'sl' AND DATETIME(prescriptions.startdate, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') ORDER BY prescriptions.startdate DESC LIMIT 1
### Instruction: Undeleted answers that were deleted from review. ### Response:
SELECT e.PostId AS "post_link", p.Score, p.CreationDate AS "creation_date", e.CreationDate AS "undeletion_date" FROM PostHistory AS e INNER JOIN Posts AS p ON p.Id = e.PostId WHERE e.PostHistoryTypeId = 13 AND p.PostTypeId = 2 AND p.Id NOT IN (SELECT f.PostId FROM PostHistory AS f WHERE f.PostHistoryTypeId = 12) AND p.Score > 0 ORDER BY e.CreationDate DESC
### Instruction: count the number of patients whose diagnoses long title is unspecified hereditary and idiopathic peripheral neuropathy and lab test category is hematology. ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Unspecified hereditary and idiopathic peripheral neuropathy" AND lab."CATEGORY" = "Hematology"
### Instruction: when until 2104 patient 013-33898 received a procedure for the last time? ### 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 = '013-33898')) AND STRFTIME('%y', treatment.treatmenttime) <= '2104' ORDER BY treatment.treatmenttime DESC LIMIT 1
### Instruction: since 50 months ago has patient 99747 been prescribed calcium gluconate, labetalol, or meropenem? ### Response:
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 99747) AND prescriptions.drug IN ('calcium gluconate', 'labetalol', 'meropenem') AND DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-50 month')
### Instruction: Number of Posts closed as duplicates. ### Response:
WITH stub_list AS (SELECT p.Id, p.Score, pl.RelatedPostId FROM Posts AS p JOIN PostLinks AS pl ON pl.PostId = p.Id WHERE p.PostTypeId = 1 AND EXISTS(SELECT * FROM PostHistory AS ph WHERE ph.PostId = p.Id AND ph.PostHistoryTypeId IN (10)) AND pl.LinkTypeId = 3) SELECT COUNT(s.Id) AS "closed as duplicate" FROM stub_list AS s JOIN Posts AS p ON p.Id = s.RelatedPostId
### Instruction: Show the apartment numbers of apartments with bookings that have status code both 'Provisional' and 'Confirmed ### Response:
SELECT T2.apt_number FROM apartment_bookings AS T1 JOIN apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = "Confirmed" INTERSECT SELECT T2.apt_number FROM apartment_bookings AS T1 JOIN apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = "Provisional"
### Instruction: has patient 97330 received an order of isotonic sodium chloride, cisatracurium besylate, or tamoxifen citrate during the current hospital encounter? ### Response:
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 97330 AND admissions.dischtime IS NULL) AND prescriptions.drug IN ('isotonic sodium chloride', 'cisatracurium besylate', 'tamoxifen citrate')
### Instruction: Next semester , what time is the LHC 520 lecture ? ### Response:
SELECT DISTINCT course_offering.start_time FROM course INNER JOIN program_course ON program_course.course_id = course.course_id INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE course.department = 'LHC' AND course.number = 520 AND semester.semester = 'FA' AND semester.year = 2016
### Instruction: Question View count (that are <10k) with average and grouped by user. ### Response:
SELECT p.OwnerUserId AS "user_link", SUM(ViewCount) AS VC, AVG(ViewCount) AS AVC, COUNT(p.OwnerUserId) AS QC FROM Posts AS p JOIN Users ON p.OwnerUserId = Users.Id WHERE PostTypeId = 1 AND ViewCount < 10000 AND CommunityOwnedDate IS NULL GROUP BY p.OwnerUserId HAVING COUNT(p.OwnerUserId) > 50 ORDER BY VC DESC LIMIT 100
### Instruction: All my answers with score. ### Response:
SELECT answers.Id AS "post_link", answers.Score AS pontuacao, answers.OwnerUserId AS "user_link", CAST(TIME_TO_STR(answers.CreationDate, '%d/%m/%Y') AS TEXT(30)) AS CreationDate FROM Posts AS answers WHERE answers.OwnerUserId = @UserId AND answers.PostTypeId = 2 AND answers.ClosedDate IS NULL AND answers.DeletionDate IS NULL AND answers.Score = 0 AND answers.AcceptedAnswerId = @UserId ORDER BY CreationDate
### Instruction: what's patient 51675's maximum value of monocytes until 40 months ago? ### Response:
SELECT MAX(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 51675) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'monocytes') AND DATETIME(labevents.charttime) <= DATETIME(CURRENT_TIME(), '-40 month')
### Instruction: tell me the first value of lactate in patient 022-187132 in their current hospital visit? ### Response:
SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-187132' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = 'lactate' ORDER BY lab.labresulttime LIMIT 1
### Instruction: 1996[2] larger than 68, and a 1990 smaller than 352, and a 1970 larger than 105, and a 1950 of 119 is the sum of what 1980? ### Response:
SELECT SUM("1980") FROM table_36167 WHERE "1996[2]" > '68' AND "1990" < '352' AND "1970" > '105' AND "1950" = '119'
### Instruction: Shows the number of questions and most recent question for the top X users since a given date.. Shows the number of questions and most recent question for the top X users since a given date. ### Response:
WITH TopUsers AS (SELECT Id FROM Users ORDER BY Reputation DESC LIMIT 500) SELECT u.Id AS "user_link", COUNT(*) AS QuestionCount, MAX(CreationDate) AS LastQuestionDate FROM TopUsers AS u INNER JOIN Posts AS p ON p.OwnerUserId = u.Id WHERE p.PostTypeId = 1 AND p.CreationDate >= '##BeginDate##' GROUP BY u.Id
### Instruction: how many times did patient 005-46456 receive surgery consultation in 2104? ### Response:
SELECT COUNT(*) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-46456')) AND treatment.treatmentname = 'surgery consultation' AND STRFTIME('%y', treatment.treatmenttime) = '2104'
### Instruction: what was the name of the specimen test that patient 031-3355 had first received in this hospital encounter? ### 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-3355' AND patient.hospitaldischargetime IS NULL)) ORDER BY microlab.culturetakentime LIMIT 1
### Instruction: Top 25 Users by reputation with # of questions, answers. ### Response:
SELECT ROW_NUMBER() OVER (ORDER BY u.Reputation DESC) AS "#", u.Id AS "user_link", u.Reputation, (SELECT COUNT(p.Id) FROM Posts AS p WHERE p.OwnerUserId = u.Id AND p.PostTypeId = 1) AS Questions, (SELECT COUNT(p.Id) FROM Posts AS p WHERE p.OwnerUserId = u.Id AND p.PostTypeId = 2) AS Answers FROM Users AS u ORDER BY Reputation DESC LIMIT 25
### Instruction: what would be the maximum daily number of patients diagnosed with splenic trauma - grade ii laceration since 2105? ### Response:
SELECT MAX(t1.c1) FROM (SELECT COUNT(DISTINCT diagnosis.patientunitstayid) AS c1 FROM diagnosis WHERE diagnosis.diagnosisname = 'splenic trauma - grade ii laceration' AND STRFTIME('%y', diagnosis.diagnosistime) >= '2105' GROUP BY STRFTIME('%y-%m-%d', diagnosis.diagnosistime)) AS t1
### Instruction: what are the four most commonly taken tests in the lab in 2105 for patients of age 60 or above? ### Response:
SELECT t1.labname FROM (SELECT lab.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age >= 60) AND STRFTIME('%y', lab.labresulttime) = '2105' GROUP BY lab.labname) AS t1 WHERE t1.c1 <= 4
### Instruction: what were the names of the drug that patient 028-61375 was allergic to until 60 months ago? ### Response:
SELECT allergy.drugname FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '028-61375')) AND DATETIME(allergy.allergytime) <= DATETIME(CURRENT_TIME(), '-60 month')
### Instruction: what medical procedure did patient 030-53416 last receive on the first hospital visit? ### Response:
SELECT treatment.treatmentname FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-53416' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1)) ORDER BY treatment.treatmenttime DESC LIMIT 1
### Instruction: what laboratory test was given to patient 70267 last time during this month? ### Response:
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT labevents.itemid FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 70267) AND DATETIME(labevents.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') ORDER BY labevents.charttime DESC LIMIT 1)
### Instruction: How many users have actually read the entire Tour page? (statistically). Counts how many users have actually read the entire Tour page, based on how many who has received the 'Informed' badge. ### Response:
SELECT (SELECT COUNT(Id) FROM Users) AS Users, COUNT(b.UserId) AS BadgeHolders, (CAST(COUNT(b.UserId) AS FLOAT) / (SELECT COUNT(Id) FROM Users) * 100) AS Percentage FROM Users AS u LEFT JOIN Badges AS b ON b.UserId = u.Id WHERE b.Name = 'Informed'
### Instruction: what is the totality of patient 27591's input until 1567 days ago? ### 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 = 27591)) AND DATETIME(inputevents_cv.charttime) <= DATETIME(CURRENT_TIME(), '-1567 day')
### Instruction: Closed questions that need to be deleted. ### Response:
SELECT CAST(DATEDIFF(DAY, ClosedDate, GETDATE()) AS FLOAT) AS Days, Posts.Title AS Title, 'https://stackoverflow.com/q/' + LTRIM(Posts.Id) AS url, Posts.Score AS Score FROM Posts WHERE CAST(DATEDIFF(DAY, ClosedDate, GETDATE()) AS FLOAT) != 0 AND Posts.Score <= '##Score##' ORDER BY -(CAST(DATEDIFF(DAY, ClosedDate, GETDATE()) AS FLOAT))
### Instruction: patients with significant hepatic or renal disease ( serum creatinine > 1.8 mg / dl ( > 159 umol / l ) for male or > 1.6 mg / dl ( > 141 umol / l ) for female ) ### Response:
SELECT * FROM table_dev_52 WHERE hepatic_disease = 1 OR renal_disease = 1 OR (serum_creatinine > 1.8 AND gender = 'male') OR (serum_creatinine > 1.6 AND gender = 'female')
### Instruction: Closed questions on which you COMMENTED (and whether they were edited after close). ### Response:
SELECT Id AS "post_link", Score, ViewCount AS "views", OwnerUserId AS "asker", CreationDate AS "asked", ClosedDate AS "closed", LastEditDate AS "edited", CASE WHEN LastEditDate > ClosedDate THEN 'yes' ELSE 'no' END AS "edited_after_close?" FROM Posts WHERE NOT ClosedDate IS NULL AND Id IN (SELECT DISTINCT PostId FROM Comments WHERE UserId = '##UserID##') ORDER BY CreationDate DESC
### Instruction: For those employees who do not work in departments with managers that have ids between 100 and 200, give me the comparison about the average of salary over the hire_date bin hire_date by time by a bar chart, and list by the mean salary from high to low please. ### Response:
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(SALARY) DESC
### Instruction: How many courses each teacher taught? Show me a stacked bar chart The x-axis is the teacher's first name and group by course description, and order in descending by the bars. ### Response:
SELECT EMP_FNAME, COUNT(EMP_FNAME) FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM JOIN COURSE AS T3 ON T1.CRS_CODE = T3.CRS_CODE GROUP BY CRS_DESCRIPTION, EMP_FNAME ORDER BY EMP_FNAME DESC
### Instruction: when did the last lab test of patient 007-8317 on their first hospital visit take place? ### Response:
SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-8317' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1)) ORDER BY lab.labresulttime DESC LIMIT 1
### Instruction: For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the distribution of hire_date and the amount of hire_date bin hire_date by weekday in a bar chart, rank Y-axis from high to low order. ### Response:
SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY COUNT(HIRE_DATE) DESC
### Instruction: which is the medication patient 006-43795 is allergic to since 158 months ago? ### Response:
SELECT allergy.drugname FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-43795')) AND DATETIME(allergy.allergytime) >= DATETIME(CURRENT_TIME(), '-158 month')
### Instruction: Is RCARTS 385 section 269 offered this Summer 2014 semester ? ### Response:
SELECT COUNT(*) > 0 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_offering.section_number = 269 AND course.department = 'RCARTS' AND course.number = 385 AND semester.semester = 'Summer' AND semester.year = 2014
### Instruction: when did patient 23929 receive a lab test in 08/last year last time? ### Response:
SELECT labevents.charttime FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 23929) AND DATETIME(labevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', labevents.charttime) = '08' ORDER BY labevents.charttime DESC LIMIT 1
### Instruction: Show me courses that include any parts of Digital Communication Signals and Systems and Devising Theatre . ### Response:
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN area ON course.course_id = area.course_id WHERE (area.area LIKE '%Devising Theatre%' OR course.description LIKE '%Devising Theatre%' OR course.name LIKE '%Devising Theatre%') AND (area.area LIKE '%Digital Communication Signals and Systems%' OR course.description LIKE '%Digital Communication Signals and Systems%' OR course.name LIKE '%Digital Communication Signals and Systems%')
### Instruction: Is CONDUCT 407 offered right now ? ### Response:
SELECT COUNT(*) > 0 FROM course, course_offering, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.department = 'CONDUCT' AND course.number = 407 AND offering_instructor.offering_id = course_offering.offering_id AND semester.semester = 'WN' AND semester.semester_id = course_offering.semester AND semester.year = 2016
### Instruction: has patient 030-44598 received a medication in this month? ### Response:
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-44598')) AND DATETIME(medication.drugstarttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month')
### Instruction: give me the total of patient 027-165214's output on the current icu visit. ### 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 = '027-165214') AND patient.unitdischargetime IS NULL) AND intakeoutput.cellpath LIKE '%output%'
### Instruction: what is the yearly minimum of patient 027-141930's weight until 2101? ### Response:
SELECT MIN(patient.admissionweight) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-141930') AND NOT patient.admissionweight IS NULL AND STRFTIME('%y', patient.unitadmittime) <= '2101' GROUP BY STRFTIME('%y', patient.unitadmittime)
### Instruction: What upper level REEES classes are available this Winter ? ### Response:
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program_course, semester WHERE course.course_id = course_offering.course_id AND course.department = 'REEES' AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = 'Winter' AND semester.semester_id = course_offering.semester AND semester.year = 2016
### Instruction: Distribution of HNQs based on minutes until entering. ### Response:
WITH times_cte AS (SELECT p.Id AS pid, p.CreationDate AS cre, ph.CreationDate AS hot, CAST((JULIANDAY(CreationDate) - JULIANDAY(p.CreationDate)) * 1440.0 AS INT) AS minutes FROM PostHistory AS ph INNER JOIN Posts AS p ON ph.PostId = p.Id WHERE ph.PostHistoryTypeId = 52) SELECT minutes, COUNT(pid) AS Count FROM times_cte GROUP BY minutes ORDER BY minutes
### Instruction: For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, show me about the distribution of job_id and the average of manager_id , and group by attribute job_id in a bar chart. ### Response:
SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID
### Instruction: Show the number of courses for each office in a bar chart, and I want to display X in ascending order please. ### Response:
SELECT PROF_OFFICE, COUNT(PROF_OFFICE) FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM JOIN COURSE AS T3 ON T1.CRS_CODE = T3.CRS_CODE JOIN PROFESSOR AS T4 ON T2.EMP_NUM = T4.EMP_NUM GROUP BY PROF_OFFICE ORDER BY PROF_OFFICE
### Instruction: what's the maximum cost of a hospital that includes a drug called alteplase (catheter clearance) until 1 year ago? ### Response:
SELECT MAX(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT prescriptions.hadm_id FROM prescriptions WHERE prescriptions.drug = 'alteplase (catheter clearance)') AND DATETIME(cost.chargetime) <= DATETIME(CURRENT_TIME(), '-1 year') GROUP BY cost.hadm_id) AS t1
### Instruction: tell me the maximum hospital cost when there is coronary artery disease - of vein graft? ### Response:
SELECT MAX(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'coronary artery disease - of vein graft')) GROUP BY cost.patienthealthsystemstayid) AS t1
### Instruction: Bounties (with users) between two dates. ### Response:
SELECT bs.PostId AS "post_link", u.Id AS "user_link", u.Reputation, bs.CreationDate, bs.BountyAmount FROM Users AS u INNER JOIN Votes AS bs ON u.Id = bs.UserId WHERE bs.VoteTypeId = 8 AND bs.CreationDate >= '##Date1?2020-06-01##' AND bs.CreationDate <= '##Date2?2020-07-01##' ORDER BY bs.CreationDate DESC
### Instruction: has patient 25814 been ordered ns, cefazolin, or neo*iv*gentamicin since 2 years ago? ### Response:
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 25814) AND prescriptions.drug IN ('cefazolin', 'ns', 'neo*iv*gentamicin') AND DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-2 year')
### Instruction: tell me the name of the medication patient 63368 was last prescribed via po/ng route in 02/2104? ### Response:
SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 63368) AND prescriptions.route = 'po/ng' AND STRFTIME('%y-%m', prescriptions.startdate) = '2104-02' ORDER BY prescriptions.startdate DESC LIMIT 1
### Instruction: provide the number of patients whose gender is m and diagnoses long title is unspecified procedure as the cause of abnormal reaction of patient, or of later complication, without mention of misadventure at time of procedure? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "M" AND diagnoses.long_title = "Unspecified procedure as the cause of abnormal reaction of patient, or of later complication, without mention of misadventure at time of procedure"
### Instruction: Which average Net profit/loss (SEK) has Employees (Average/Year) larger than 18,786, and a Year ended of 2000*, and Passengers flown larger than 23,240,000? ### Response:
SELECT AVG("Net profit/loss (SEK)") FROM table_34014 WHERE "Employees (Average/Year)" > '18,786' AND "Year ended" = '2000*' AND "Passengers flown" > '23,240,000'
### Instruction: did patient 30826 receive any tests for free calcium in this month? ### Response:
SELECT COUNT(*) > 0 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'free calcium') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 30826) AND DATETIME(labevents.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month')
### Instruction: Which classes that satisfy the ULCS necessity are least demanding ? ### Response:
SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 WHERE PROGRAM_COURSEalias1.category LIKE '%ULCS%')
### Instruction: User with both the Gold Java and Gold Kotlin tag badges. ### Response:
SELECT u.DisplayName FROM (SELECT b.UserId FROM Badges AS b WHERE b.Name = 'java' AND b.Class = 1 AND b.TagBased = 1) AS jb INNER JOIN (SELECT b.UserId FROM Badges AS b WHERE b.Name = 'kotlin' AND b.Class = 1 AND b.TagBased = 1) AS kb ON kb.UserId = jb.UserId INNER JOIN Users AS u ON u.Id = kb.UserId ORDER BY u.DisplayName
### Instruction: For those employees who do not work in departments with managers that have ids between 100 and 200, a bar chart shows the distribution of hire_date and the sum of employee_id bin hire_date by weekday, rank by the y-axis in asc. ### Response:
SELECT HIRE_DATE, SUM(EMPLOYEE_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SUM(EMPLOYEE_ID)
### Instruction: have patient 013-27480 had a diagnosis this year? ### Response:
SELECT COUNT(*) > 0 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-27480')) AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
### Instruction: Upvotes as more than N% of votes. ### Response:
SELECT Id AS "user_link", Reputation, UpVotes, DownVotes, (1.0 * DownVotes / (1.0 * UpVotes + 1.0 * DownVotes)) AS PercentDown FROM Users WHERE DownVotes > 0 AND (1.0 * DownVotes / (1.0 * UpVotes + 1.0 * DownVotes)) > @PERCENT / 100.0 AND (UpVotes + DownVotes) > @MIN_VOTES ORDER BY DownVotes DESC
### Instruction: when has patient 032-18678 received the first lab test in the last hospital visit? ### Response:
SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '032-18678' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1)) ORDER BY lab.labresulttime LIMIT 1
### Instruction: did patient 51675 undergo an absolute lymphocyte count test until 3 years ago? ### Response:
SELECT COUNT(*) > 0 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'absolute lymphocyte count') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 51675) AND DATETIME(labevents.charttime) <= DATETIME(CURRENT_TIME(), '-3 year')
### Instruction: has there been a microbiology test conducted in 10/this year on patient 73713? ### Response:
SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 73713) AND DATETIME(microbiologyevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', microbiologyevents.charttime) = '10'
### Instruction: did patient 021-32860 receive any surgical procedures during the previous year? ### Response:
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-32860')) AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')
### Instruction: For those employees who do not work in departments with managers that have ids between 100 and 200, return a bar chart about the distribution of hire_date and the sum of manager_id bin hire_date by time, I want to list by the total number in descending. ### Response:
SELECT HIRE_DATE, SUM(MANAGER_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SUM(MANAGER_ID) DESC
### Instruction: Who are Daphne Koller 's coauthors ### Response:
SELECT DISTINCT AUTHOR_1.authorid FROM author AS AUTHOR_0, author AS AUTHOR_1, writes AS WRITES_0, writes AS WRITES_1 WHERE AUTHOR_0.authorname = 'Daphne Koller' AND WRITES_0.authorid = AUTHOR_0.authorid AND WRITES_1.authorid = AUTHOR_1.authorid AND WRITES_1.paperid = WRITES_0.paperid
### Instruction: Which 2007/ 08 has a 2008/ 09 of tournament not held, a 2005/ 06 of tournament not held, and a 1999/ 00 of tournament not held? ### Response:
SELECT "2007/ 08" FROM table_62377 WHERE "2008/ 09" = 'tournament not held' AND "2005/ 06" = 'tournament not held' AND "1999/ 00" = 'tournament not held'
### Instruction: Show the famous titles of the artists with both volumes that lasted more than 2 weeks on top and volumes that lasted less than 2 weeks on top. ### Response:
SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T2.Weeks_on_Top > 2 INTERSECT SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T2.Weeks_on_Top < 2
### Instruction: How many Loans Received have Disbursements larger than 21,857,565, and Contributions greater than 3,869,613 with Receipts under 11,405,771? ### Response:
SELECT COUNT("Loans Received") FROM table_54362 WHERE "All Disbursements" > '21,857,565' AND "Contributions" > '3,869,613' AND "All Receipts" < '11,405,771'
### Instruction: how many hours have passed since patient 17667 stayed during their current hospital encounter in the careunit micu for the last time? ### Response:
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', transfers.intime)) FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 17667 AND admissions.dischtime IS NULL) AND transfers.careunit = 'micu' ORDER BY transfers.intime DESC LIMIT 1
### Instruction: how many patients whose ethnicity is black/cape verdean and diagnoses long title is diabetes with renal manifestations, type ii or unspecified type, not stated as uncontrolled? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND diagnoses.long_title = "Diabetes with renal manifestations, type II or unspecified type, not stated as uncontrolled"
### Instruction: in 12/this year, when did patient 32153 receive the last lab test? ### Response:
SELECT labevents.charttime FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 32153) AND DATETIME(labevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', labevents.charttime) = '12' ORDER BY labevents.charttime DESC LIMIT 1
### Instruction: tell me the amount of input that patient 26350 has been given until 999 days ago? ### 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 = 26350)) AND DATETIME(inputevents_cv.charttime) <= DATETIME(CURRENT_TIME(), '-999 day')