instruction
stringlengths 37
754
| output
stringlengths 9
3.43k
|
---|---|
### Instruction:
what was the last anion gap value when they visited the hospital first time for patient 69819?
### Response:
|
SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 69819 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'anion gap') ORDER BY labevents.charttime DESC LIMIT 1
|
### Instruction:
tell me the drug that patient 021-25705 had an allergic reaction to in 11/2105?
### 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 = '021-25705')) AND STRFTIME('%y-%m', allergy.allergytime) = '2105-11'
|
### Instruction:
count the number of drugs patient 005-16601 had been prescribed in the previous year.
### 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 = '005-16601')) AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')
|
### Instruction:
Questions answered by users with > X reputation.
### Response:
|
SELECT Q.Id, SUM(IIF(U.Reputation >= @Reputation, 1, 0)) AS HighRep, SUM(IIF(U.Reputation < @Reputation, 1, 0)) AS LowRep FROM Posts AS Q LEFT JOIN (Posts AS A INNER JOIN Users AS U ON A.OwnerUserId = U.Id) ON A.ParentId = Q.Id WHERE Q.ParentId IS NULL AND Q.CreationDate > DATEADD(m, -1, GETDATE()) AND NOT A.Id IS NULL GROUP BY Q.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 sum of employee_id over the hire_date bin hire_date by time by a bar chart, 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:
tell me the name of the procedure that patient 015-66570 was first received in 2105?
### 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 = '015-66570')) AND STRFTIME('%y', treatment.treatmenttime) = '2105' ORDER BY treatment.treatmenttime LIMIT 1
|
### Instruction:
count the number of times patient 027-28154 has received a calcium laboratory test until 3 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 = '027-28154')) AND lab.labname = 'calcium' AND DATETIME(lab.labresulttime) <= DATETIME(CURRENT_TIME(), '-3 year')
|
### Instruction:
Tags associated with 'homework' tag ordered by question count. This query can help with the 'homework' tag cleanup. Each tag listed in this result is associated with the given number of 'homework' questions.
### Response:
|
SELECT COUNT(*), at.TagName FROM PostTags AS a JOIN PostTags AS b ON (a.PostId = b.PostId) JOIN Tags AS at ON (a.TagId = at.Id) JOIN Tags AS bt ON (b.TagId = bt.Id) WHERE bt.TagName = 'homework' AND at.TagName != 'homework' GROUP BY at.TagName ORDER BY 1 DESC
|
### Instruction:
what is patient 017-61209's maximum value of total protein in the first hospital encounter?
### Response:
|
SELECT MAX(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 = '017-61209' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1)) AND lab.labname = 'total protein'
|
### Instruction:
Percent of questions with a given tag per day.
### Response:
|
WITH QuesTagInfo(quesId, quesCreationDate, quesHasTag) AS (SELECT Id AS quesId, DATE(CreationDate) AS quesCreationDate, CASE WHEN (Tags LIKE ('%<##TagName##>%')) THEN 1 ELSE 0 END AS quesHasTag FROM Posts WHERE PostTypeId = 1) SELECT quesCreationDate, COUNT(*) AS "total_questions", SUM(quesHasTag) AS "has_tag" FROM QuesTagInfo GROUP BY quesCreationDate ORDER BY quesCreationDate
|
### Instruction:
when's the last time patient 011-23004's systemicdiastolic was measured or taken?
### 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 = '011-23004')) AND NOT vitalperiodic.systemicdiastolic IS NULL ORDER BY vitalperiodic.observationtime DESC LIMIT 1
|
### Instruction:
What upper level ENSCEN classes are available Fall semester ?
### 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 = 'ENSCEN' AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = 'Fall' AND semester.semester_id = course_offering.semester AND semester.year = 2016
|
### Instruction:
For Winter or Fall 2007 , What computing infrastructure courses are offered ?
### Response:
|
SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course INNER JOIN area ON course.course_id = area.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 area.area LIKE '%computing infrastructure%' AND semester.semester IN ('WN', 'FA') AND semester.year = 2007
|
### Instruction:
Which Lane has a Rank larger than 3, and a Time larger than 45.63, and a Reaction smaller than 0.28800000000000003, and an Athlete of geiner mosquera?
### Response:
|
SELECT MAX("Lane") FROM table_65922 WHERE "Rank" > '3' AND "Time" > '45.63' AND "React" < '0.28800000000000003' AND "Athlete" = 'geiner mosquera'
|
### Instruction:
How many posts have I edited.
### Response:
|
SELECT COUNT(DISTINCT c.Id) - COUNT(DISTINCT a.Id) FROM PostHistory AS a, PostHistory AS b, PostHistory AS c WHERE a.UserId = 1417185 AND b.UserId = a.UserId AND c.UserId = a.UserId AND a.PostHistoryTypeId IN (1, 2, 3) AND b.PostHistoryTypeId IN (4, 5, 6) AND c.PostHistoryTypeId IN (1, 2, 3, 4, 5, 6)
|
### Instruction:
count the number of times that patient 030-47098 had received oxygen therapy (> 60%) - non-rebreather mask procedures.
### 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 = '030-47098')) AND treatment.treatmentname = 'oxygen therapy (> 60%) - non-rebreather mask'
|
### Instruction:
Who is the teacher that gave a student a C while minoring in RELIGION ?
### 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 '%C%' OR student_record.grade LIKE '%C%') AND student.minor = 'RELIGION'
|
### 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 manager_id over the hire_date bin hire_date by weekday, and I want to show by the mean manager id in descending.
### 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) DESC
|
### Instruction:
what is the maximum cost of the hospital which involves esophagogastroduodenoscopy - with chemocautery?
### 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 treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'esophagogastroduodenoscopy - with chemocautery')) GROUP BY cost.patienthealthsystemstayid) AS t1
|
### Instruction:
has patient 004-86136 undergone an tissue biopsy procedure in another hospital?
### Response:
|
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '004-86136' AND patient.hospitalid <> (SELECT DISTINCT patient.hospitalid FROM patient WHERE patient.uniquepid = '004-86136' AND patient.hospitaldischargetime IS NULL)) AND treatment.treatmentname = 'tissue biopsy'
|
### Instruction:
Next semester , what classes are available as PreMajor ?
### 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 '%PreMajor%' 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:
what was the name of the lab test that patient 010-17316 has first received since 9 months ago?
### Response:
|
SELECT lab.labname FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-17316')) AND DATETIME(lab.labresulttime) >= DATETIME(CURRENT_TIME(), '-9 month') ORDER BY lab.labresulttime LIMIT 1
|
### Instruction:
Find the transaction type descriptions and dates if the share count is smaller than 10, group by transaction type, count the date of transaction, and bin the date into the weekday interval, I want to order by the total number from low to high please.
### Response:
|
SELECT T2.date_of_transaction, COUNT(T2.date_of_transaction) FROM Ref_Transaction_Types AS T1 JOIN Transactions AS T2 ON T1.transaction_type_code = T2.transaction_type_code WHERE T2.share_count < 10 GROUP BY transaction_type_description ORDER BY COUNT(date_of_transaction)
|
### Instruction:
tell me the total of patient 12927's inputs during a day before?
### 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 = 12927)) AND DATETIME(inputevents_cv.charttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-1 day')
|
### Instruction:
how much ipratropium bromide neb dose has been prescribed to patient 3229 since 12/2105?
### Response:
|
SELECT SUM(prescriptions.dose_val_rx) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 3229) AND prescriptions.drug = 'ipratropium bromide neb' AND STRFTIME('%y-%m', prescriptions.startdate) >= '2105-12'
|
### Instruction:
What 's the easiest class to take to fulfill the ULCS 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 '%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:
upvote and downvote count broken down by post type.
### Response:
|
SELECT COUNT(*), pt.Name, vt.Name FROM Votes AS v, Posts AS p, PostTypes AS pt, VoteTypes AS vt WHERE v.PostId = p.Id AND v.VoteTypeId IN (2, 3) AND p.PostTypeId IN (1, 2) AND pt.Id = p.PostTypeId AND vt.Id = v.VoteTypeId AND p.OwnerUserId = 5373 GROUP BY pt.Name, vt.Name ORDER BY pt.Name, vt.Name
|
### Instruction:
What is the paper about Semantic Image Segmentation of the most citation ?
### Response:
|
SELECT DISTINCT cite.citedpaperid, COUNT(cite.citedpaperid) FROM cite, keyphrase, paper, paperkeyphrase WHERE keyphrase.keyphrasename = 'Semantic Image Segmentation' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = cite.citedpaperid AND paper.paperid = paperkeyphrase.paperid GROUP BY cite.citedpaperid ORDER BY COUNT(cite.citedpaperid) DESC
|
### Instruction:
what is the number of patients whose admission type is emergency and primary disease is neoplasm of uncertain behavior of other lymphatic and hematopoietic tissues\bone marrow transplant?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.diagnosis = "NEOPLASM OF UNCERTAIN BEHAVIOR OF OTHER LYMPHATIC AND HEMATOPOIETIC TISSUES\BONE MARROW TRANSPLANT"
|
### Instruction:
in this hospital visit, was there a microbiological test of patient 031-3355's blood, venipuncture?
### Response:
|
SELECT COUNT(*) 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)) AND microlab.culturesite = 'blood, venipuncture'
|
### Instruction:
how many times had patient 033-3992 been on ferrous iron compound since 2105?
### 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 = '033-3992')) AND treatment.treatmentname = 'ferrous iron compound' AND STRFTIME('%y', treatment.treatmenttime) >= '2105'
|
### Instruction:
what was the drug which during the first hospital encounter had been prescribed to patient 95235 two times?
### Response:
|
SELECT t1.drug FROM (SELECT prescriptions.drug, COUNT(prescriptions.startdate) AS c1 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 95235 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 = 2
|
### Instruction:
What classes are available this Fall that would count towards a CS major ?
### 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 = 'Fall' AND semester.semester_id = course_offering.semester AND semester.year = 2016
|
### Instruction:
Who has taught a course in which a student minoring in EECS has gotten an B ?
### 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 = 'EECS'
|
### Instruction:
since 2100 what are the five most frequently ordered lab tests for patients 40s?
### 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 BETWEEN 40 AND 49) AND STRFTIME('%y', lab.labresulttime) >= '2100' GROUP BY lab.labname) AS t1 WHERE t1.c1 <= 5
|
### Instruction:
when did the last laboratory test of patient 009-5801 take place until 62 months ago?
### 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 = '009-5801')) AND DATETIME(lab.labresulttime) <= DATETIME(CURRENT_TIME(), '-62 month') ORDER BY lab.labresulttime DESC LIMIT 1
|
### Instruction:
had patient 005-87465 ever been given lipids on the current icu visit?
### Response:
|
SELECT COUNT(*) > 0 FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-87465') AND patient.unitdischargetime IS NULL) AND intakeoutput.cellpath LIKE '%intake%' AND intakeoutput.celllabel = 'lipids'
|
### Instruction:
what test did patient 005-4044 go through for the first time since 12/2101?
### Response:
|
SELECT lab.labname FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-4044')) AND STRFTIME('%y-%m', lab.labresulttime) >= '2101-12' ORDER BY lab.labresulttime LIMIT 1
|
### Instruction:
What upper-level NAVARCH classes could be taken this Spring ?
### 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 = 'NAVARCH' AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = 'Spring' AND semester.semester_id = course_offering.semester AND semester.year = 2016
|
### Instruction:
Is Prof. Riseng the only teacher who teaches Digital Cultures ?
### 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 '%Digital Cultures%' AND NOT instructor.name LIKE '%Riseng%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id
|
### Instruction:
how much was enoxaparin sodium first prescribed to patient 27362 in 06/2104?
### Response:
|
SELECT prescriptions.dose_val_rx FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 27362) AND prescriptions.drug = 'enoxaparin sodium' AND STRFTIME('%y-%m', prescriptions.startdate) = '2104-06' ORDER BY prescriptions.startdate LIMIT 1
|
### Instruction:
Who are the prominent researchers in Neutralizing Antibody in 2012 ?
### Response:
|
SELECT DISTINCT COUNT(paper.paperid), writes.authorid FROM keyphrase, paper, paperkeyphrase, writes WHERE keyphrase.keyphrasename = 'Neutralizing Antibody' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid AND paper.year = 2012 AND writes.paperid = paper.paperid GROUP BY writes.authorid ORDER BY COUNT(paper.paperid) DESC
|
### Instruction:
what are the minimum yearly number of patients diagnosed with failure to wean - due to elevated metabolic rate since 2104?
### Response:
|
SELECT MIN(t1.c1) FROM (SELECT COUNT(DISTINCT diagnosis.patientunitstayid) AS c1 FROM diagnosis WHERE diagnosis.diagnosisname = 'failure to wean - due to elevated metabolic rate' AND STRFTIME('%y', diagnosis.diagnosistime) >= '2104' GROUP BY STRFTIME('%y', diagnosis.diagnosistime)) AS t1
|
### Instruction:
Aside from Prof. Oches , does anyone else teach Special Readings ?
### 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 '%Special Readings%' AND NOT instructor.name LIKE '%Oches%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id
|
### Instruction:
ENSCEN 171 can be taken at the moment ?
### Response:
|
SELECT COUNT(*) > 0 FROM course, course_offering, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.department = 'ENSCEN' AND course.number = 171 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:
how many patients whose primary disease is neoplasm of uncertain behavior of other lymphatic and hematopoietic tissues\bone marrow transplant and year of birth is less than 2156?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "NEOPLASM OF UNCERTAIN BEHAVIOR OF OTHER LYMPHATIC AND HEMATOPOIETIC TISSUES\BONE MARROW TRANSPLANT" AND demographic.dob_year < "2156"
|
### Instruction:
Comments to unanswered unclosed questions.
### Response:
|
SELECT Posts.Id AS "post_link", Posts.CommentCount AS "comments", Posts.Score AS "score", Posts.CreationDate AS "asked", Comments.CreationDate AS "commented", Comments.Score AS "upvotes", Comments.Text AS "comment" FROM Comments JOIN Posts ON Posts.Id = Comments.PostId WHERE Comments.UserId = '##UserId##' AND Posts.PostTypeId = 1 AND Posts.AnswerCount = 0 AND Posts.ClosedDate IS NULL
|
### 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, give me the trend about employee_id over hire_date , and could you order HIRE_DATE in descending order please?
### 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:
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:
Unanswered Questions with Tags Similar to Answered Questions.
### Response:
|
SELECT Id AS "post_link", P.Tags FROM Posts AS P WHERE P.Tags IN (SELECT Tags FROM Posts AS P2 WHERE Id IN (SELECT Id FROM Posts WHERE P2.PostTypeId = 1 AND P2.AnswerCount > 0 AND NOT P2.AcceptedAnswerId IS NULL AND P2.Tags = P.Tags AND NOT P2.CommunityOwnedDate IS NULL)) AND P.PostTypeId = 1 AND NOT P.CommunityOwnedDate IS NULL AND P.AnswerCount = 0
|
### 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 average of manager_id bin hire_date by weekday, I want to rank in desc by the y axis.
### 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) DESC
|
### Instruction:
Is there a 16 -credit course that is NATIVEAM 400 -level ?
### Response:
|
SELECT DISTINCT course.department, course.name, course.number 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 program_course.category LIKE '%ULCS%' AND semester.semester = 'FA' AND semester.year = 2016
|
### Instruction:
Soft [self-learning] questions without MathJax.
### Response:
|
SELECT Score, Id AS "post_link", CreationDate, Tags FROM Posts WHERE PostTypeId = 1 AND Tags LIKE '%<self-learning>%' AND (Tags LIKE '%<advice>%' OR Tags LIKE '%<soft-question>%' OR Tags LIKE '%<big-list>%' OR Tags LIKE '%<education>%' OR Tags LIKE '%<teaching>%' OR Tags = '<self-learning>' OR (NOT Body LIKE '%$%' AND NOT Body LIKE '\begin')) AND NOT Tags LIKE '%<learning>%' ORDER BY CreationDate
|
### 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:
How many 300 -level classes are in the Fall or Winter term ?
### Response:
|
SELECT COUNT(DISTINCT course.course_id, semester.semester) FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number BETWEEN 300 AND 300 + 100 AND semester.semester IN ('FA', 'WN') AND semester.semester_id = course_offering.semester AND semester.year = 2016
|
### 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:
I 'm looking for the easiest class I can take to fulfill 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:
Is there an ORALHEAL 400 -level class that is 9 -credit ?
### Response:
|
SELECT DISTINCT course.department, course.name, course.number 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 program_course.category LIKE '%ULCS%' AND semester.semester = 'FA' AND semester.year = 2016
|
### 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:
Tags with highest average answer scores.
### Response:
|
SELECT t.TagName, COUNT(a.Id) AS NumAnswers, SUM(a.Score) AS TotalScore, AVG(a.Score + 0.0) AS AvgScore FROM Posts AS a JOIN Posts AS q ON a.ParentId = q.Id JOIN PostTags AS pt ON pt.PostId = q.Id JOIN Tags AS t ON t.Id = pt.TagId WHERE a.PostTypeId = 2 GROUP BY t.TagName, t.Id HAVING COUNT(q.Id) >= 1000 ORDER BY AvgScore DESC
|
### Instruction:
first time patient 006-71495 got surgery until 3 years ago?
### 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 = '006-71495')) AND DATETIME(treatment.treatmenttime) <= DATETIME(CURRENT_TIME(), '-3 year') ORDER BY treatment.treatmenttime LIMIT 1
|
### Instruction:
For the MDE program requirement , who teaches courses that fulfill it ?
### 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 '%MDE%'
|
### Instruction:
How many courses for each teacher? Show me a bar chart, and show y-axis in descending order.
### 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 JOIN PROFESSOR AS T4 ON T2.EMP_NUM = T4.EMP_NUM GROUP BY EMP_FNAME ORDER BY COUNT(EMP_FNAME) DESC
|
### Instruction:
what was the last procedure time patient 004-7984 went through in their last hospital visit?
### 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 = '004-7984' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1)) ORDER BY treatment.treatmenttime DESC LIMIT 1
|
### Instruction:
Unanswered questions by user reputation and question score.
### Response:
|
SELECT p.Id AS "post_link", p.ViewCount AS "views", p.CommentCount AS "comments", u.Reputation AS "user_reputation", p.CreationDate AS "date" FROM Posts AS p, Users AS u WHERE p.ClosedDate IS NULL AND p.AnswerCount = 0 AND u.Reputation <= '##Reputation:int?10##' AND p.Score = '##Score:int?0##' AND p.OwnerUserId = u.Id ORDER BY p.CreationDate LIMIT 500
|
### Instruction:
Show stupid posts (Freeze, Crash, Bug).
### Response:
|
SELECT pt.PostId AS "post_link", p.Score, p.ViewCount FROM Tags AS t, PostTags AS pt, Posts AS p WHERE pt.TagId = t.Id AND p.Id = pt.PostId AND t.TagName IN ('freeze', 'crash', 'bug') AND p.AcceptedAnswerId IS NULL AND p.ClosedDate IS NULL AND p.Id NOT IN (SELECT ps.ParentId FROM Posts AS ps WHERE ps.PostTypeId = 2 AND ps.Score > 1) ORDER BY ViewCount DESC
|
### Instruction:
show me the latest flight to DAL
### Response:
|
SELECT DISTINCT flight.flight_id FROM airport, flight WHERE airport.airport_code = 'DAL' AND flight.departure_time = (SELECT MAX(FLIGHTalias1.departure_time) FROM airport AS AIRPORTalias1, flight AS FLIGHTalias1 WHERE AIRPORTalias1.airport_code = 'DAL' AND FLIGHTalias1.to_airport = AIRPORTalias1.airport_code) AND flight.to_airport = airport.airport_code
|
### Instruction:
Questions with [tag] by users with reputation equal or greater than [threshold].
### Response:
|
SELECT Posts.Id AS "post_link", Score, @curyear - YEAR(Posts.CreationDate) AS "years_old", Users.Id AS "user_link", AnswerCount AS "answers", CommentCount AS "comments", ViewCount AS "viewed" FROM Posts LEFT JOIN Users ON OwnerUserId = Users.Id WHERE PostTypeId = @question AND Tags LIKE '%<' + @tag + '>%' AND Reputation >= @minrep ORDER BY 'answers', 'comments', Score DESC
|
### Instruction:
what is the cost of hx-female genit malg nec diagnostic tests?
### Response:
|
SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'diagnoses_icd' AND cost.event_id IN (SELECT diagnoses_icd.row_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'hx-female genit malg nec'))
|
### Instruction:
until 03/2104, what was the average mcv value for patient 69289?
### Response:
|
SELECT AVG(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 69289) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'mcv') AND STRFTIME('%y-%m', labevents.charttime) <= '2104-03'
|
### Instruction:
did patient 031-3355 have any microbiological test result since 12/2104?
### 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-3355')) AND STRFTIME('%y-%m', microlab.culturetakentime) >= '2104-12'
|
### Instruction:
was patient 2536 since 03/2104 prescribed furosemide, vial, or zolpidem tartrate?
### Response:
|
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 2536) AND prescriptions.drug IN ('furosemide', 'vial', 'zolpidem tartrate') AND STRFTIME('%y-%m', prescriptions.startdate) >= '2104-03'
|
### Instruction:
what procedure did patient 016-25367 undergo for the last time since 2103?
### 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 = '016-25367')) AND STRFTIME('%y', treatment.treatmenttime) >= '2103' ORDER BY treatment.treatmenttime DESC LIMIT 1
|
### Instruction:
main topics of work by Brian DeRenzi
### Response:
|
SELECT DISTINCT keyphrase.keyphrasename, SUM(paper.numcitedby) FROM author, keyphrase, paper, paperkeyphrase, writes WHERE author.authorname = 'Brian DeRenzi' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid AND writes.authorid = author.authorid AND writes.paperid = paper.paperid GROUP BY keyphrase.keyphrasename ORDER BY SUM(paper.numcitedby) DESC
|
### Instruction:
Users by Location and Tags.
### Response:
|
SELECT DISTINCT u.Id AS "user_link", u.DisplayName, u.Reputation, u.Location FROM Posts AS p JOIN Posts AS pp ON pp.ParentId = p.Id JOIN PostTags AS pt ON pt.PostId = p.Id JOIN Tags AS t ON t.Id = pt.TagId JOIN Users AS u ON u.Id = pp.OwnerUserId WHERE t.TagName = '##tagname##' AND LOWER(u.Location) LIKE LOWER('%##locationname##%') ORDER BY u.Reputation DESC, u.Id
|
### Instruction:
Posts which had given tag in the past.
### Response:
|
SELECT DISTINCT PostHistory.PostId AS "post_link", url = 'site://posts/' + CAST(PostHistory.PostId AS TEXT) + '/revisions', Posts.OwnerUserId AS "user_link", Posts.Score, Posts.Tags, Posts.CreationDate, Posts.LastActivityDate FROM PostHistory INNER JOIN Posts ON PostHistory.PostId = Posts.Id WHERE PostHistoryTypeId IN (3, 6, 9) AND Text LIKE '%<##tagName##>%' ORDER BY CreationDate
|
### Instruction:
in 2105 had patient 88180 been prescribed epoetin alfa, lisinopril or diphenhydramine?
### Response:
|
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 88180) AND prescriptions.drug IN ('epoetin alfa', 'lisinopril', 'diphenhydramine') AND STRFTIME('%y', prescriptions.startdate) = '2105'
|
### Instruction:
give me the number of patients whose diagnoses long title is unspecified hereditary and idiopathic peripheral neuropathy and drug type is base?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Unspecified hereditary and idiopathic peripheral neuropathy" AND prescriptions.drug_type = "BASE"
|
### Instruction:
when was the first time that patient 022-43717 had received a enteral feeds - oral feeds procedure?
### 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 = '022-43717')) AND treatment.treatmentname = 'enteral feeds - oral feeds' ORDER BY treatment.treatmenttime LIMIT 1
|
### Instruction:
For the Winter or Fall 2011 term what computational science courses are offered ?
### Response:
|
SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course INNER JOIN area ON course.course_id = area.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 area.area LIKE '%computational science%' AND semester.semester IN ('WN', 'FA') AND semester.year = 2011
|
### Instruction:
Obsolete 'should be wiki' comments. comments containing 'should be wiki' or 'should be a wiki' on CW questions
### Response:
|
SELECT c.PostId AS "post_link", C.CreationDate, c.Text AS Body FROM Comments AS C, Posts AS P WHERE ((C.Text LIKE '%should be wiki%' OR C.Text LIKE '%should be a wiki%') AND C.PostId = P.Id AND P.ClosedDate IS NULL AND P.PostTypeId = 1 AND NOT CommunityOwnedDate IS NULL) ORDER BY CreationDate LIMIT 1000
|
### Instruction:
has any procedure been performed on patient 006-205326 in a year before?
### 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 = '006-205326')) AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')
|
### Instruction:
Which courses does Prof. Shelly Alilunas teach in addition to 672 ?
### Response:
|
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.number <> 672 AND instructor.name LIKE '%Shelly Alilunas%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id
|
### Instruction:
how much memantine is prescribed the last time in the previous month to patient 27703?
### Response:
|
SELECT prescriptions.dose_val_rx FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 27703) AND prescriptions.drug = 'memantine' AND DATETIME(prescriptions.startdate, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') ORDER BY prescriptions.startdate DESC LIMIT 1
|
### Instruction:
What 's the easiest class that fulfills the ULCS 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 '%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:
how many times does patient 004-7984 receive an glucose test until 143 months 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 = '004-7984')) AND lab.labname = 'glucose' AND DATETIME(lab.labresulttime) <= DATETIME(CURRENT_TIME(), '-143 month')
|
### Instruction:
have prednisone, metoprolol tartrate, or insulin been prescribed for patient 1462 since 08/2105?
### Response:
|
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1462) AND prescriptions.drug IN ('prednisone', 'metoprolol tartrate', 'insulin') AND STRFTIME('%y-%m', prescriptions.startdate) >= '2105-08'
|
### Instruction:
how many patients on base type prescription drug have diagnoses of inhalation and ingestion of other object causing obstruction of respiratory tract or suffocation?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Inhalation and ingestion of other object causing obstruction of respiratory tract or suffocation" AND prescriptions.drug_type = "BASE"
|
### Instruction:
Number of review tasks per day.
### Response:
|
SELECT CreationDate, '1' AS "suggested_edits", '2' AS "close_votes", '3' AS "low_quality_posts", '4' AS "first_posts", '5' AS "late_answers", '6' AS "reopen_votes" FROM (SELECT Id, ReviewTaskTypeId, CreationDate FROM ReviewTasks) AS temp PIVOT(COUNT(Id) FOR ReviewTaskTypeId IN ('1', '2', '3', '4', '5', '6')) AS pvt ORDER BY CreationDate DESC
|
### Instruction:
Comments by one user on answers by another user.
### Response:
|
SELECT a.Id AS "Post Link", a.Score AS "A.Score", a.Body AS "A.Body", c.Text AS "C.Text", c.Score AS "C.Score" FROM Posts AS q JOIN Posts AS a ON q.Id = a.ParentId JOIN Comments AS c ON a.Id = c.PostId WHERE a.PostTypeId = 2 AND a.OwnerUserId = '##AnswererID:int##' AND c.UserId = '##CommenterID:int##' ORDER BY a.Score DESC
|
### Instruction:
what was the name of the last lab test that was given to patient 51663 until 09/2105?
### 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 = 51663) AND STRFTIME('%y-%m', labevents.charttime) <= '2105-09' ORDER BY labevents.charttime DESC LIMIT 1)
|
### Instruction:
during the last hospital visit, when did patient 017-74343 last receive a lab test?
### 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 = '017-74343' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1)) ORDER BY lab.labresulttime DESC LIMIT 1
|
### Instruction:
Any chances I can take ASTRO 401 now ?
### Response:
|
SELECT COUNT(*) > 0 FROM course, course_offering, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.department = 'ASTRO' AND course.number = 401 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:
patients must have symptomatic disease requiring therapy. one or more of the following must be present to be eligible: symptomatic lymphadenopathy ; hepatomegaly and / or splenomegaly ; anemia ( hb < 110 g / l )
### Response:
|
SELECT * FROM table_test_32 WHERE symptomatic_disease = 1 OR (symptomatic_lymphadenopathy = 1 OR hepatomegaly = 1 OR splenomegaly = 1 OR anemia = 1 OR hb < 110)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.