instruction
stringlengths 53
549
| output
stringlengths 30
2.33k
|
---|---|
### Instruction:
How many answers are accepted?.
### Response:
| SELECT COUNT(a.Id) AS "# answers", SUM(CASE WHEN q.AcceptedAnswerId = a.Id THEN 1 ELSE 0 END) AS "# accepted answers", CAST(1.0 * COUNT(q.AcceptedAnswerId) / COUNT(a.Id) AS FLOAT(3, 2)) AS "fraction accepted" FROM Posts AS q JOIN Posts AS a ON a.ParentId = q.Id JOIN Votes AS v ON v.PostId = a.Id WHERE q.PostTypeId = 1 AND v.VoteTypeId = 1 |
### Instruction:
give me the number of patients whose procedure long title is arteriography of other intra-abdominal arteries and lab test fluid is cerebrospinal fluid (csf)?
### 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 = "Arteriography of other intra-abdominal arteries" AND lab.fluid = "Cerebrospinal Fluid (CSF)" |
### Instruction:
what are the five most commonly ordered lab tests for patients with age 60 or above until 1 year ago?
### 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 DATETIME(lab.labresulttime) <= DATETIME(CURRENT_TIME(), '-1 year') GROUP BY lab.labname) AS t1 WHERE t1.c1 <= 5 |
### Instruction:
what time has patient 10211 first had an intake on the first intensive care unit visit?
### Response:
| SELECT inputevents_cv.charttime FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 10211) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1) ORDER BY inputevents_cv.charttime LIMIT 1 |
### Instruction:
Get question information given answer IDs.
### Response:
| SELECT MyAnswers.Id AS AnswerID, p.Id AS QuestionID, p.CreationDate, p.ViewCount, p.Tags FROM Posts AS p INNER JOIN (SELECT Id, ParentId FROM Posts WHERE Id IN (25210096, 25222542, 25240280, 25233555, 25307353, 25310175)) AS MyAnswers ON p.Id = MyAnswers.ParentId |
### Instruction:
What classes that count towards the CS major will be available this Spring ?
### Response:
| SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program, program_course, semester WHERE program_course.course_id = course.course_id AND program_course.course_id = course.course_id AND program.name LIKE '%CS%' AND program.program_id = program_course.program_id AND semester.semester = 'Spring' AND semester.semester_id = course_offering.semester AND semester.year = 2016 |
### Instruction:
Reputation Frequency Distribution with parameters. From http://data.stackexchange.com/stackoverflow/query/90233/reputation-frequency-distribution
### Response:
| SELECT FLOOR(Reputation / '##step:int?1000##') * '##step##' AS "userreputation", LN(CAST(COUNT(Id) AS FLOAT)) AS "logusercount" FROM Users WHERE Reputation >= '##MinimumReputation:int?102##' GROUP BY FLOOR(Reputation / '##step##') ORDER BY FLOOR(Reputation / '##step##') |
### Instruction:
tell me the number of times patient 006-129568 had received a mode lab test since 5 years ago.
### Response:
| SELECT COUNT(*) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-129568')) AND lab.labname = 'mode' AND DATETIME(lab.labresulttime) >= DATETIME(CURRENT_TIME(), '-5 year') |
### Instruction:
calculate how many times patient 030-47098 has received a phenytoin laboratory test until 2102.
### Response:
| SELECT COUNT(*) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-47098')) AND lab.labname = 'phenytoin' AND STRFTIME('%y', lab.labresulttime) <= '2102' |
### Instruction:
Show votes on my questions.
### Response:
| SELECT Posts.Id, Posts.Title, Posts.Score, CASE Votes.VoteTypeId WHEN 2 THEN 'up' WHEN 3 THEN 'down' WHEN 15 THEN 'mod review' WHEN 16 THEN 'approve edit' ELSE CONCAT('<', Votes.VoteTypeId, '>') END AS VoteType FROM Posts JOIN Votes ON Posts.Id = Votes.PostId WHERE Posts.OwnerUserId = '##UserId##' AND Posts.PostTypeId = 1 ORDER BY Posts.LastActivityDate DESC |
### 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:
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:
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:
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:
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:
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:
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:
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:
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 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:
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:
What are the special topics classes offered next Winter ?
### 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:
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, show me about the distribution of hire_date and the amount of hire_date bin hire_date by time in a bar chart, could you rank y axis from low to high 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) |
### Instruction:
has patient 027-23129 been having any allergy a year before?
### Response:
| SELECT COUNT(*) > 0 FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-23129')) AND DATETIME(allergy.allergytime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') |
### 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, visualize a line chart about the change of employee_id over hire_date , display in desc by the x-axis.
### 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 DESC |
### Instruction:
what was the name of the last test that patient 22983 recieved since 173 months ago?
### 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 = 22983) AND DATETIME(labevents.charttime) >= DATETIME(CURRENT_TIME(), '-173 month') ORDER BY labevents.charttime DESC LIMIT 1) |
### Instruction:
My score and number of non-CW answers per tag.
### Response:
| SELECT t.TagName, SUM(a.Score) AS "total_score", COUNT(a.Id) AS "answer_count" FROM Posts AS a INNER JOIN Posts AS q ON q.Id = a.ParentId INNER JOIN PostTags AS pt ON q.Id = pt.PostId INNER JOIN Tags AS t ON pt.TagId = t.Id WHERE (a.OwnerUserId = '##userid##') AND (a.CommunityOwnedDate IS NULL) GROUP BY t.TagName ORDER BY SUM(a.Score) DESC |
### Instruction:
what are the names of the medicines patient 005-76770 is allergic to during their last hospital visit?
### 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 = '005-76770' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1)) |
### Instruction:
Users with zero accept rate. Does not count self-answers.
Shows users with at least @MinAnswers answers.
### Response:
| SELECT u.Id AS "user_link", COUNT(*) AS NumQuestions, SUM(CASE WHEN NOT q.AcceptedAnswerId IS NULL THEN 1 ELSE 0 END) AS NumAccepted, MIN(u.Reputation) AS Reputation FROM Posts AS q INNER JOIN Users AS u ON u.Id = q.OwnerUserId WHERE q.PostTypeId = 1 GROUP BY u.Id ORDER BY NumAccepted, NumQuestions DESC LIMIT 1000 |
### Instruction:
Find answers with more score than the accepted answer.
### Response:
| SELECT answer.Id AS "post_link", answer.Score AS "Score", acceptedAnswer.Score AS "Score Accepted" FROM Posts AS answer JOIN Posts AS question ON question.Id = answer.ParentId JOIN Posts AS acceptedAnswer ON acceptedAnswer.Id = question.AcceptedAnswerId WHERE NOT question.AcceptedAnswerId IS NULL AND answer.PostTypeId = 2 AND answer.OwnerUserId = '##UserId:int##' AND answer.Id != acceptedAnswer.Id AND answer.Score > acceptedAnswer.Score ORDER BY answer.Score DESC |
### Instruction:
how many patients are admitted before 2121 and diagnosed for personal history of transient ischemic attack (tia) and cerebral infarction without residual deficits?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2121" AND diagnoses.long_title = "Personal history of transient ischemic attack (TIA), and cerebral infarction without residual deficits" |
### Instruction:
Is LHC 510 section 688 available in the Winter 2000 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 = 688 AND course.department = 'LHC' AND course.number = 510 AND semester.semester = 'Winter' AND semester.year = 2000 |
### Instruction:
what was the organism that was found in the last microbiology test of patient 24894's blood culture (post-mortem)?
### Response:
| SELECT microbiologyevents.org_name FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 24894) AND microbiologyevents.spec_type_desc = 'blood culture (post-mortem)' AND NOT microbiologyevents.org_name IS NULL ORDER BY microbiologyevents.charttime DESC LIMIT 1 |
### Instruction:
Year-to-year ratio of single-word-requests questions.
### Response:
| SELECT YEAR(p.CreationDate), SUM(CASE WHEN NOT t.Id IS NULL THEN 1 ELSE 0 END) / CAST(COUNT(p.Id) AS FLOAT) AS "ratio of id requests" FROM Posts AS p JOIN PostTags AS pt ON pt.PostId = p.Id LEFT OUTER JOIN Tags AS t ON t.Id = pt.TagId AND t.TagName = 'single-word-requests' WHERE p.PostTypeId = 1 GROUP BY YEAR(p.CreationDate) |
### Instruction:
Are there any classes available next semester as MDE ?
### 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 '%MDE%' 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:
Most answers in one day.
### Response:
| SELECT u.Id, u.DisplayName, u.Location, u.Reputation, DATE(p.CreationDate) AS PostDate, COUNT(p.Id) AS Posts FROM Posts AS p, Users AS u WHERE p.OwnerUserId = u.Id AND p.PostTypeId = 2 GROUP BY DATE(p.CreationDate), u.Id, u.DisplayName, u.Location, u.Reputation HAVING COUNT(p.Id) > 20 ORDER BY COUNT(p.Id) DESC, u.Id LIMIT 500 |
### 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 time in a bar chart, and order by the y axis in ascending.
### 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) |
### Instruction:
Has LACS 400 ever been taught by Serena Ng ?
### Response:
| SELECT COUNT(*) > 0 FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'LACS' AND course.number = 400 AND instructor.name LIKE '%Serena Ng%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id |
### Instruction:
how many times do patient 378 get a anticardiolipin antibody igg test in the first hospital visit?
### Response:
| SELECT COUNT(*) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'anticardiolipin antibody igg') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 378 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) |
### Instruction:
What is the easiest class I can take to get the Core 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 '%Core%' 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 '%Core%') |
### Instruction:
tell me the name of the allergy patient 006-42293 has since 51 months ago?
### Response:
| SELECT allergy.allergyname FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-42293')) AND DATETIME(allergy.allergytime) >= DATETIME(CURRENT_TIME(), '-51 month') |
### Instruction:
how many days have passed since patient 20898 stayed in careunit csru for the last time during the current hospital visit?
### Response:
| SELECT 1 * (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 = 20898 AND admissions.dischtime IS NULL) AND transfers.careunit = 'csru' ORDER BY transfers.intime DESC LIMIT 1 |
### Instruction:
In the Winter classes offered , what are ULCS classes ?
### 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 INNER JOIN program_course ON program_course.course_id = course_offering.course_id WHERE program_course.category LIKE '%ULCS%' AND semester.semester = 'Winter' AND semester.year = 2017 |
### Instruction:
How much 0 100km/h, s has a Fuel of diesel, and a Torque of n m (lb ft) @1900 rpm, and an Engine ID code(s) of agr/alh?
### Response:
| SELECT COUNT("0\u2013100km/h,s") FROM table_60126 WHERE "Fuel" = 'diesel' AND "Torque" = 'n·m (lb·ft) @1900 rpm' AND "Engine ID code(s)" = 'agr/alh' |
### Instruction:
For those employees who do not work in departments with managers that have ids between 100 and 200, draw a bar chart about the distribution of hire_date and the average of salary bin hire_date by time, I want to rank by the y-axis from low to high.
### 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) |
### 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 hire_date and the average of employee_id bin hire_date by weekday in a bar chart.
### Response:
| SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 |
### Instruction:
when was the first time, patient 62977 was prescribed 1/2 ns until 02/2105?
### Response:
| SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 62977) AND prescriptions.drug = '1/2 ns' AND STRFTIME('%y-%m', prescriptions.startdate) <= '2105-02' ORDER BY prescriptions.startdate LIMIT 1 |
### Instruction:
Which 2011 12 has a 2010 11 smaller than 26.016, and a Rank 2013 larger than 20, and a Club of rubin kazan?
### Response:
| SELECT AVG("2011\u201312") FROM table_58615 WHERE "2010\u201311" < '26.016' AND "Rank 2013" > '20' AND "Club" = 'rubin kazan' |
### Instruction:
Distribution of number of votes on questions.
### Response:
| WITH a AS (SELECT p.Id, COUNT(v.PostId) AS n_votes FROM Votes AS v FULL OUTER JOIN Posts AS p ON v.PostId = p.Id WHERE p.PostTypeId IN (1) AND v.VoteTypeId IN (2, 3) GROUP BY p.Id), b AS (SELECT pp.Id, n_votes FROM a FULL OUTER JOIN Posts AS pp ON a.Id = pp.Id WHERE pp.PostTypeId IN (1)) SELECT * FROM b ORDER BY Id DESC |
### 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, draw a line chart about the change of manager_id over hire_date , could you show x axis from low to high order?
### Response:
| SELECT HIRE_DATE, MANAGER_ID FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY HIRE_DATE |
### Instruction:
Posts with broken Chabadlibrary.org links.
### Response:
| SELECT p.Id AS "post_link", (CASE WHEN NOT p.Title IS NULL THEN p.Title ELSE pq.Title END) AS title, p.CreationDate, p.LastActivityDate, p.Score, (CASE WHEN NOT p.ViewCount IS NULL THEN p.ViewCount ELSE pq.ViewCount END) AS viewcount FROM Posts AS p LEFT OUTER JOIN Posts AS pq ON pq.Id = p.ParentId WHERE p.Body LIKE '%chabadlibrary.org%furl=%' ORDER BY ViewCount DESC |
### Instruction:
what was the name of the specimen test that patient 85895 has gotten the first the last month?
### Response:
| SELECT microbiologyevents.spec_type_desc FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 85895) AND DATETIME(microbiologyevents.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') ORDER BY microbiologyevents.charttime LIMIT 1 |
### Instruction:
Which class could be the easiest to fulfill the Other 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 '%Other%' 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 '%Other%') |
### Instruction:
Angular vs Ember vs React last Month.
### Response:
| SELECT rate.TagName AS Tag, ROW_NUMBER() OVER (ORDER BY rate.Rate DESC) AS Rank, rate.Rate AS NumQuestions FROM (SELECT COUNT(PostId) AS Rate, TagName FROM Tags, PostTags, Posts WHERE Tags.Id = PostTags.TagId AND Posts.Id = PostId AND Posts.CreationDate > DATEADD(Month, -1, GETDATE()) AND TagName IN ('angularjs', 'ember.js', 'reactjs') GROUP BY TagName) AS rate ORDER BY rate.rate DESC |
### Instruction:
how many times did patient 26057 take a lab immunoglobulin m test in 2105?
### Response:
| SELECT COUNT(*) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'immunoglobulin m') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26057) AND STRFTIME('%y', labevents.charttime) = '2105' |
### Instruction:
how many hours have passed since patient 2957 stayed in the careunit sicu on this hospital encounter for the first 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 = 2957 AND admissions.dischtime IS NULL) AND transfers.careunit = 'sicu' ORDER BY transfers.intime LIMIT 1 |
### Instruction:
how many hours has it been since the last time patient 31854 visited careunit ccu during this 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 = 31854 AND admissions.dischtime IS NULL) AND transfers.careunit = 'ccu' ORDER BY transfers.intime DESC LIMIT 1 |
### Instruction:
what are the numbers of patients who had ns .9% intake?
### Response:
| SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT icustays.hadm_id FROM icustays WHERE icustays.icustay_id IN (SELECT inputevents_cv.icustay_id FROM inputevents_cv WHERE inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'ns .9%' AND d_items.linksto = 'inputevents_cv'))) |
### Instruction:
in 2105 was there any microbiological test history of patient 031-17834?
### Response:
| SELECT COUNT(*) > 0 FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-17834')) AND STRFTIME('%y', microlab.culturetakentime) = '2105' |
### Instruction:
Who teaches courses that fulfill a Core program requirement ?
### 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 program_course ON program_course.course_id = course_offering.course_id INNER JOIN program ON program.program_id = program_course.program_id WHERE program.name LIKE '%Core%' |
### Instruction:
Question pairs closed as the dupe of each other.
### Response:
| SELECT A.PostId AS "post_link", B.PostId AS "post_link" FROM PostLinks AS A, PostLinks AS B, Posts AS D, Posts AS O WHERE A.PostId = D.Id AND A.RelatedPostId = B.PostId AND B.RelatedPostId = A.PostId AND A.LinkTypeId = 3 AND B.LinkTypeId = 3 AND B.PostId = O.Id AND A.PostId < B.PostId ORDER BY A.PostId |
### Instruction:
Number of questions by people with the Informed badge.
### Response:
| SELECT p.OwnerUserId AS Owner, p.Id AS "post_link", CASE WHEN NOT b.Id IS NULL THEN 1 ELSE 0 END AS Informed, CASE WHEN b.Id IS NULL THEN 1 ELSE 0 END AS Uninformed, p.Score, p.ViewCount AS Views FROM Posts AS p LEFT OUTER JOIN Badges AS b ON b.UserId = p.OwnerUserId AND b.Name = 'Informed' WHERE p.PostTypeId = 1 ORDER BY p.OwnerUserId DESC |
### Instruction:
How many students taking a course who received an A or C? Group by students' first name with a bar chart, and show by the how many stu fname in asc please.
### Response:
| SELECT STU_FNAME, COUNT(STU_FNAME) FROM STUDENT AS T1 JOIN ENROLL AS T2 ON T1.STU_NUM = T2.STU_NUM WHERE T2.ENROLL_GRADE = 'C' OR T2.ENROLL_GRADE = 'A' GROUP BY STU_FNAME ORDER BY COUNT(STU_FNAME) |
### 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, draw a line chart about the change of department_id over hire_date , and show by the x-axis in desc.
### Response:
| SELECT HIRE_DATE, DEPARTMENT_ID FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY HIRE_DATE DESC |
### Instruction:
How many papers were written on Multiuser Receiver in the Decision Feedback this year ?
### Response:
| SELECT DISTINCT paper.paperid FROM keyphrase, paper, paperkeyphrase WHERE keyphrase.keyphrasename = 'Multiuser Receiver in the Decision Feedback' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid AND paper.year = 2016 GROUP BY paper.paperid HAVING COUNT(DISTINCT keyphrase.keyphrasename) > 1 |
### Instruction:
What are the country names, area and population which has both roller coasters with speed higher
### Response:
| SELECT T1.name, T1.area, T1.population FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID WHERE T2.speed > 60 INTERSECT SELECT T1.name, T1.area, T1.population FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID WHERE T2.speed < 55 |
### Instruction:
Edits that removed the mathematical-physics tag.
### Response:
| SELECT edits.PostId AS "post_link", edits.CreationDate, edits.Text AS "Edited tags", originalTags.Text AS "Original tags" FROM PostHistory AS edits JOIN PostHistory AS originalTags ON originalTags.PostId = edits.PostId WHERE edits.PostHistoryTypeId = 6 AND originalTags.PostHistoryTypeId = 3 AND originalTags.Text LIKE '%mathematical-physics%' AND NOT edits.Text LIKE '%mathematical-physics%' ORDER BY edits.CreationDate DESC |
### Instruction:
is there anything patient 028-55503 has had a diagnosis with since 1 year ago?
### 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 = '028-55503')) AND DATETIME(diagnosis.diagnosistime) >= DATETIME(CURRENT_TIME(), '-1 year') |
### Instruction:
Which teachers offer courses that fulfill a Other program requirement ?
### 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 program_course ON program_course.course_id = course_offering.course_id INNER JOIN program ON program.program_id = program_course.program_id WHERE program.name LIKE '%Other%' |
### Instruction:
Show Vote History for a Post.
### Response:
| SELECT v.Id, v.PostId AS "post_link", v.UserId AS "user_link", v.CreationDate, v.BountyAmount, v.VoteTypeId, vt.Name FROM Posts AS p JOIN Votes AS v ON (p.Id = v.PostId) JOIN VoteTypes AS vt ON (v.VoteTypeId = vt.Id) WHERE p.Id = @PostId AND v.VoteTypeId IN (2, 3) ORDER BY v.CreationDate DESC |
### Instruction:
what was the dosage of ezetimibe that was last prescribed to patient 82159 during their last hospital encounter?
### Response:
| SELECT prescriptions.dose_val_rx FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 82159 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND prescriptions.drug = 'ezetimibe' ORDER BY prescriptions.startdate DESC LIMIT 1 |
### Instruction:
Number of questions which get closed (per day, between dates).
### Response:
| SELECT DATE(p.CreationDate), COUNT(p.ClosedDate) AS closed, COUNT(*) AS total, ROUND((COUNT(p.ClosedDate)) * 100.0 / (COUNT(p.Id)), 2) AS percentage FROM Posts AS p WHERE p.CreationDate >= '##Date1##' AND p.CreationDate <= '##Date2##' AND p.PostTypeId = 1 GROUP BY DATE(p.CreationDate) ORDER BY DATE(p.CreationDate) |
### Instruction:
Who are the teachers of upper-level classes ?
### Response:
| SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN program_course ON program_course.course_id = course.course_id WHERE program_course.category LIKE '%ULCS%' |
### Instruction:
Which of your posts have been downvoted?. Lists posts (including both questions and answers) owned by the given user that have been downvoted at least once, sorted by number of downvotes in descending order.
### Response:
| SELECT P.Id AS "post_link", P.CreationDate, COUNT(*) AS DownVotes FROM Posts AS P JOIN Votes AS V ON P.Id = V.PostId WHERE P.OwnerUserId = '##UserId:int##' AND V.VoteTypeId = 3 GROUP BY P.Id, P.CreationDate ORDER BY COUNT(*) DESC |
### Instruction:
whats the last height of patient 013-33898 this month?
### Response:
| SELECT patient.admissionheight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-33898') AND NOT patient.admissionheight IS NULL AND DATETIME(patient.unitadmittime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') ORDER BY patient.unitadmittime DESC LIMIT 1 |
Subsets and Splits