instruction
stringlengths 37
754
| output
stringlengths 9
3.43k
|
---|---|
### Instruction:
when did patient 002-76184 for the first time have an intake?
### Response:
|
SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-76184')) AND intakeoutput.cellpath LIKE '%intake%' ORDER BY intakeoutput.intakeoutputtime LIMIT 1
|
### Instruction:
how many times during their current hospital visit is patient 022-187132 getting a vitamin b12 test?
### 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 = '022-187132' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = 'vitamin b12'
|
### Instruction:
what intake did patient 14203 have for the last time?
### Response:
|
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT inputevents_cv.itemid 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 = 14203)) ORDER BY inputevents_cv.charttime DESC LIMIT 1)
|
### Instruction:
the first time patient 20898 was prescribed bisacodyl in 12/2105?
### Response:
|
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 20898) AND prescriptions.drug = 'bisacodyl' AND STRFTIME('%y-%m', prescriptions.startdate) = '2105-12' ORDER BY prescriptions.startdate LIMIT 1
|
### Instruction:
until 28 months ago, what was the first drug patient 27172 was prescribed via the iv drip route?
### Response:
|
SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 27172) AND prescriptions.route = 'iv drip' AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-28 month') ORDER BY prescriptions.startdate LIMIT 1
|
### Instruction:
the total number of times since 2102 patient 83709 has had a lab test for hemoglobin.
### Response:
|
SELECT COUNT(*) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'hemoglobin') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 83709) AND STRFTIME('%y', labevents.charttime) >= '2102'
|
### Instruction:
Can you tell me who the teacher is for ANTHRBIO 161 ?
### Response:
|
SELECT DISTINCT instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'ANTHRBIO' AND course.number = 161 AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id
|
### Instruction:
until 3 years ago, what were the top five most common intakes?
### Response:
|
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT t1.itemid FROM (SELECT inputevents_cv.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM inputevents_cv WHERE DATETIME(inputevents_cv.charttime) <= DATETIME(CURRENT_TIME(), '-3 year') GROUP BY inputevents_cv.itemid) AS t1 WHERE t1.c1 <= 5)
|
### Instruction:
calculate the number of times that morphine sulfate was prescribed to patient 007-849 during this hospital visit.
### 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 = '007-849' AND patient.hospitaldischargetime IS NULL)) AND medication.drugname = 'morphine sulfate'
|
### Instruction:
Among patients who had a lab test for urine, how many of them had coronary artery disease or coronary artery bypass graft with MVR maze as their primary disease?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "CORONARY ARTERY DISEASE\CORONARY ARTERY BYPASS GRAFT WITH MVR; ? MAZE" AND lab.fluid = "Urine"
|
### Instruction:
did patient 24971 be prescribed warfarin, albuterol mdi, or glucagon on their last hospital encounter?
### Response:
|
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 24971 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND prescriptions.drug IN ('warfarin', 'albuterol mdi', 'glucagon')
|
### Instruction:
What is the resurrection of 144,000 date with a Christ made king date in 1914, a separting sheep & goats date during Christ's presence, and a judgment of religion date in 1878?
### Response:
|
SELECT "Resurrection of144,000" FROM table_7479 WHERE "Christ madeKing" = '1914' AND "Separating Sheep &Goats" = 'during christ''s presence' AND "Judgmentof Religion" = '1878'
|
### Instruction:
what is the amount of bisacodyl dose prescribed to patient 16554 since 01/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 = 16554) AND prescriptions.drug = 'bisacodyl' AND STRFTIME('%y-%m', prescriptions.startdate) >= '2105-01'
|
### Instruction:
Average Question Score by Hour. Find out if time of day when you ask a question may affect the
number of votes you receive.
Results are skewed by different parts of the world being awake
at different times, with each region possibly asking questions of
different perceived quality.
### Response:
|
SELECT TIME_TO_STR(CreationDate, '%h') AS hour, COUNT(*) AS posts, AVG(CAST(Score AS FLOAT)) AS "average score" FROM Posts GROUP BY TIME_TO_STR(CreationDate, '%h') ORDER BY hour
|
### Instruction:
had patient 27392 given a lab test of total protein, body fluid in 2105?
### Response:
|
SELECT COUNT(*) > 0 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'total protein, body fluid') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 27392) AND STRFTIME('%y', labevents.charttime) = '2105'
|
### 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 salary bin hire_date by weekday, and order from low to high by the total number.
### Response:
|
SELECT HIRE_DATE, SUM(SALARY) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SUM(SALARY)
|
### Instruction:
count the number of patients who have had an cd8 cells, percent test in this year.
### Response:
|
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'cd8 cells, percent') AND DATETIME(labevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year'))
|
### Instruction:
windows phone post count, view count, view/post ratio per day.
### Response:
|
SELECT DATE(p.CreationDate) AS pdate, COUNT(*) AS nposts_per_day, SUM(p.ViewCount) AS nviews_per_day, SUM(p.ViewCount) / COUNT(*) AS view_post_ratio FROM Tags JOIN PostTags AS pt ON Tags.Id = pt.TagId JOIN Posts AS p ON pt.PostId = p.Id WHERE Tags.TagName = @TagName GROUP BY DATE(p.CreationDate) ORDER BY pdate DESC LIMIT 365
|
### Instruction:
how many times does in 06/2105 patient 65401 get a specific gravity test?
### Response:
|
SELECT COUNT(*) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'specific gravity') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 65401) AND STRFTIME('%y-%m', labevents.charttime) = '2105-06'
|
### Instruction:
Count the number of patients taking drug via pb route with aortic insufficiency/re-do sternostomy aortic valve replacement as their primary disease.
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.diagnosis = "AORTIC INSUFFICIENCY\RE-DO STERNOTOMY; AORTIC VALVE REPLACEMENT " AND prescriptions.route = "PB"
|
### Instruction:
so what's the average mch value of patient 006-157753 on their current hospital encounter?
### Response:
|
SELECT AVG(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 = '006-157753' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = 'mch'
|
### Instruction:
What are the ids, names and genders of the architects who built two bridges or one mill?
### Response:
|
SELECT T1.id, T1.name, T1.gender FROM architect AS T1 JOIN bridge AS T2 ON T1.id = T2.architect_id GROUP BY T1.id HAVING COUNT(*) = 2 UNION SELECT T1.id, T1.name, T1.gender FROM architect AS T1 JOIN mill AS T2 ON T1.id = T2.architect_id GROUP BY T1.id HAVING COUNT(*) = 1
|
### Instruction:
whats the first height of patient 006-100609 in 04/2104?
### Response:
|
SELECT patient.admissionheight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-100609') AND NOT patient.admissionheight IS NULL AND STRFTIME('%y-%m', patient.unitadmittime) = '2104-04' ORDER BY patient.unitadmittime LIMIT 1
|
### Instruction:
Close votes per tag based on PendingFlags.
### Response:
|
SELECT TagName, COUNT(*) FROM (SELECT DISTINCT t.TagName, p.Id FROM PendingFlags AS pf INNER JOIN Posts AS p ON p.Id = pf.PostId INNER JOIN PostTags AS pt ON pt.PostId = p.Id INNER JOIN Tags AS t ON t.Id = pt.TagId WHERE pf.FlagTypeId IN (13, 14) AND p.ClosedDate IS NULL AND p.PostTypeId = 1) AS tq GROUP BY TagName ORDER BY COUNT(*) DESC
|
### Instruction:
what are the specimen tests top four most frequently ordered in the last year?
### Response:
|
SELECT t1.spec_type_desc FROM (SELECT microbiologyevents.spec_type_desc, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM microbiologyevents WHERE DATETIME(microbiologyevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY microbiologyevents.spec_type_desc) AS t1 WHERE t1.c1 <= 4
|
### Instruction:
has there been any staph aureus screen microbiology test until 95 months ago for patient 99080?
### Response:
|
SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 99080) AND microbiologyevents.spec_type_desc = 'staph aureus screen' AND DATETIME(microbiologyevents.charttime) <= DATETIME(CURRENT_TIME(), '-95 month')
|
### Instruction:
has patient 021-49082 been given any medication when they came to the hospital last time?
### 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 = '021-49082' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1))
|
### Instruction:
non-positive score Answered questions, edited by OP after closing.
### Response:
|
SELECT 'lastactivitydate', Posts.CreationDate, 'lasteditdate' FROM Posts RIGHT JOIN PostFeedback ON 'postfeedback'."postid" = 'posts'."id" WHERE 'posttypeid' = 1 AND 'answercount' > 0 AND 'lasteditoruserid' = 'owneruserid' AND ('posttypeid' = 2 AND Posts.ParentId = 'postfeedback'."postid" AND Posts.CreationDate < 'lasteditdate')
|
### Instruction:
how many hours have elapsed since the first time patient 808 stayed in careunit sicu in this hospital encounter?
### 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 = 808 AND admissions.dischtime IS NULL) AND transfers.careunit = 'sicu' ORDER BY transfers.intime LIMIT 1
|
### Instruction:
number of posts in time slots.
### Response:
|
SELECT DATEFROMPARTS(TIME_TO_STR(Users.CreationDate, '%Y'), 1, 1), TIME_TO_STR(Users.CreationDate, '%Y') AS rok, COUNT(Posts.Id) AS ilosc FROM Posts INNER JOIN Users ON Users.Id = Posts.OwnerUserId WHERE Posts.PostTypeId = 1 GROUP BY TIME_TO_STR(Users.CreationDate, '%Y') ORDER BY TIME_TO_STR(Users.CreationDate, '%Y')
|
### Instruction:
What Sustainable Cities courses , if any , will satisfy the PreMajor requirement ?
### Response:
|
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN area ON course.course_id = area.course_id INNER JOIN program_course ON program_course.course_id = course.course_id WHERE (area.area LIKE '%Sustainable Cities%' OR course.description LIKE '%Sustainable Cities%' OR course.name LIKE '%Sustainable Cities%') AND program_course.category LIKE '%PreMajor%'
|
### Instruction:
How high would my reputation approximately be if there was no cap?.
### Response:
|
SELECT SUM(CASE WHEN VoteTypeId = 1 THEN 15 WHEN VoteTypeId = 2 AND PostTypeId = 1 THEN 5 WHEN VoteTypeId = 2 AND PostTypeId = 2 THEN 10 WHEN VoteTypeId = 3 THEN -2 WHEN VoteTypeId = 9 THEN BountyAmount END) AS UncappedReputation FROM Votes INNER JOIN Posts ON Posts.Id = Votes.PostId WHERE Posts.OwnerUserId = @UserId
|
### Instruction:
what is the monthly maximum amount of chloride of patient 025-42426?
### 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 = '025-42426')) AND lab.labname = 'chloride' GROUP BY STRFTIME('%y-%m', lab.labresulttime)
|
### Instruction:
Among patients who had a lab test for cerebrospinal fluid (CSF), how many of them had st elevated myocardial infarction or cardiac cath as their primary disease?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "ST ELEVATED MYOCARDIAL INFARCTION\CARDIAC CATH" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
|
### Instruction:
Number of questions with 'geopandas' tag.
### Response:
|
SELECT DATEADD(m, -DATEDIFF(m, CreationDate, GETDATE()), GETDATE()), COUNT(*) AS questions FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts ON Posts.Id = PostTags.PostId WHERE Tags.TagName = 'geopandas' GROUP BY DATEADD(m, -DATEDIFF(m, CreationDate, GETDATE()), GETDATE()) ORDER BY DATEADD(m, -DATEDIFF(m, CreationDate, GETDATE()), GETDATE())
|
### Instruction:
Tags with pending suggested wiki edits.
### Response:
|
SELECT T.TagName, T.WikiPostId AS Wiki, T.ExcerptPostId AS Excerpt, T.Count AS Questions, SEP.Comment AS "edit_comment", SEP.OwnerUserId AS "user_link" FROM Tags AS T INNER JOIN SuggestedEdits AS SEP ON SEP.PostId = T.WikiPostId INNER JOIN ReviewTasks AS RT ON RT.SuggestedEditId = SEP.PostId ORDER BY Questions DESC, SEP.CreationDate DESC
|
### Instruction:
please list all flights into DENVER before 1200 on UA and NW
### Response:
|
SELECT DISTINCT flight.flight_id FROM airport_service, city, flight WHERE ((flight.airline_code = 'NW') OR (flight.airline_code = 'UA')) AND (city.city_code = airport_service.city_code AND city.city_name = 'DENVER' AND flight.arrival_time < 1200 AND flight.to_airport = airport_service.airport_code)
|
### Instruction:
patients with controlled hypertension ( sitting diastolic bp < 95 mmhg and / or sitting systolic bp < 160 mmhg ) , right bundle branch block ( complete or partial ) , and pacemakers may be included in the study.
### Response:
|
SELECT * FROM table_train_130 WHERE hypertension = 1 OR (diastolic_blood_pressure_dbp < 95 OR systolic_blood_pressure_sbp < 160) OR right_bundle_branch_block = 1
|
### Instruction:
Is it Friday when Prof. Joshua Wall 's classes always meet ?
### Response:
|
SELECT COUNT(*) = 0 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 WHERE course_offering.friday = 'N' AND instructor.name LIKE '%Joshua Wall%'
|
### Instruction:
Tags coming most likely with your tag together.
### Response:
|
SELECT MIN(DTags.TagName) AS TagName, COUNT(*) AS Count FROM Tags AS STags, PostTags AS S, PostTags AS D, Tags AS DTags WHERE LOWER(STags.TagName) = LOWER('##TagName:string##') AND S.TagId = STags.Id AND S.PostId = D.PostId AND DTags.Id = D.TagId AND DTags.Id != S.TagId GROUP BY DTags.Id ORDER BY Count DESC, DTags.Id LIMIT 100
|
### Instruction:
Are exams always set by Prof. Johanna Eriksson for her classes ?
### Response:
|
SELECT COUNT(*) = 0 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 WHERE course.has_exams = 'N' AND instructor.name LIKE '%Johanna Eriksson%'
|
### Instruction:
during the last hospital visit, what was the minimum rdw value for patient 86792?
### Response:
|
SELECT MIN(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 86792 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'rdw')
|
### Instruction:
did patient 10855 receive the rbc lab test since 111 months ago?
### Response:
|
SELECT COUNT(*) > 0 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'rbc') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 10855) AND DATETIME(labevents.charttime) >= DATETIME(CURRENT_TIME(), '-111 month')
|
### Instruction:
Suggested Edit Review Stats (your approval rate).
### Response:
|
SELECT total, approved, rejected, ROUND(CAST(approved * 100 AS FLOAT) / total, 1) AS ApprovedPercentage, ROUND(CAST(rejected * 100 AS FLOAT) / total, 1) AS RejectedPercentage FROM (SELECT COUNT(Id) AS total, COUNT(ApprovalDate) AS approved, COUNT(RejectionDate) AS rejected FROM SuggestedEdits WHERE OwnerUserId = @UserId) AS grouped
|
### Instruction:
how many patients have been diagnosed with unspecified fetal and neonatal jaundice and were given the drug tamsulosin?
### 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 fetal and neonatal jaundice" AND prescriptions.drug = "Tamsulosin"
|
### Instruction:
calculate the number of times that patient 006-195310 had hemovac total discharge.
### Response:
|
SELECT COUNT(*) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-195310')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput.celllabel = 'hemovac total'
|
### Instruction:
which opponents in the u.s. championships played after 1945 and had a score of 3 6, 6 4, 2 6, 6 3, 20 18?
### Response:
|
SELECT "Opponents in the final" FROM table_77473 WHERE "Championship" = 'u.s. championships' AND "Year" > '1945' AND "Score" = '3–6, 6–4, 2–6, 6–3, 20–18'
|
### Instruction:
Next semester , what upper level CS classes will there be ?
### 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:
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 salary bin hire_date by weekday, rank from high to low by the y axis.
### Response:
|
SELECT HIRE_DATE, SUM(SALARY) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SUM(SALARY) DESC
|
### Instruction:
Course 322 has been taught by Prof. Zuzana Srostlik how many times ?
### Response:
|
SELECT COUNT(*) FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.number = 322 AND instructor.name LIKE '%Zuzana Srostlik%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id
|
### Instruction:
question score vs top answer score.
### Response:
|
SELECT rbin, COUNT(*) FROM (SELECT ROUND(CAST(q.Score AS FLOAT) / a.maxScore, 1) AS rbin FROM (SELECT ParentId, MAX(Score) AS maxScore FROM Posts WHERE PostTypeId = 2 GROUP BY ParentId) AS a JOIN Posts AS q ON q.Id = a.ParentId WHERE a.maxScore >= '##minTopAnswerScore?5##' AND q.Score >= '##minQuestionScore?0##') AS r GROUP BY rbin ORDER BY rbin
|
### Instruction:
What is the name and id of the staff who recorded the fault log but has not contacted any visiting engineers?
### Response:
|
SELECT T1.staff_name, T1.staff_id FROM Staff AS T1 JOIN Fault_Log AS T2 ON T1.staff_id = T2.recorded_by_staff_id EXCEPT SELECT T3.staff_name, T3.staff_id FROM Staff AS T3 JOIN Engineer_Visits AS T4 ON T3.staff_id = T4.contact_staff_id
|
### Instruction:
give me the number of patients whose diagnoses short title is atrial fibrillation and procedure long title is other and unspecified coronary arteriography?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE diagnoses.short_title = "Atrial fibrillation" AND procedures.long_title = "Other and unspecified coronary arteriography"
|
### Instruction:
count the number of patients who were tested since 1 year ago for bilirubin, total, body fluid.
### Response:
|
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'bilirubin, total, body fluid') AND DATETIME(labevents.charttime) >= DATETIME(CURRENT_TIME(), '-1 year'))
|
### Instruction:
did patient 003-39724 suffer from any type of allergy until 1 year ago?
### 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 = '003-39724')) AND DATETIME(allergy.allergytime) <= DATETIME(CURRENT_TIME(), '-1 year')
|
### Instruction:
How old are the students with allergies to food and animal types on average?
### Response:
|
SELECT AVG(age) FROM student WHERE stuid IN (SELECT T1.stuid FROM has_allergy AS T1 JOIN allergy_type AS T2 ON T1.allergy = T2.allergy WHERE T2.allergytype = "food" INTERSECT SELECT T1.stuid FROM has_allergy AS T1 JOIN allergy_type AS T2 ON T1.allergy = T2.allergy WHERE T2.allergytype = "animal")
|
### Instruction:
give me the top three most common diagnoses?
### Response:
|
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd GROUP BY diagnoses_icd.icd9_code) AS t1 WHERE t1.c1 <= 3)
|
### Instruction:
What rank has an annual interchange less than 1.99 million, an annual entry/exit less than 13.835 million, and more than 13.772 million total passengers?
### Response:
|
SELECT rank FROM table_name_83 WHERE annual_interchanges__millions__2011_12 < 1.99 AND annual_entry_exit__millions__2011_12 < 13.835 AND total_passengers__millions__2011_12 > 13.772
|
### Instruction:
give me the number of patients whose insurance is self pay and diagnoses long title is other disorders of the pituitary and other syndromes of diencephalohypophyseal origin?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Self Pay" AND diagnoses.long_title = "Other disorders of the pituitary and other syndromes of diencephalohypophyseal origin"
|
### Instruction:
Which classes are offered next Winter for Core ?
### 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 '%Core%' AND semester.semester = 'Winter' AND semester.year = 2017
|
### Instruction:
what were the five most commonly ordered specimen tests in the previous year?
### Response:
|
SELECT t1.spec_type_desc FROM (SELECT microbiologyevents.spec_type_desc, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM microbiologyevents WHERE DATETIME(microbiologyevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY microbiologyevents.spec_type_desc) AS t1 WHERE t1.c1 <= 5
|
### Instruction:
did patient 031-3355 have any kind of microbiology test in the first hospital visit?
### 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 NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1))
|
### 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 comparison about the average of salary over the job_id , and group by attribute job_id.
### Response:
|
SELECT JOB_ID, AVG(SALARY) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID
|
### Instruction:
Am I close to the 'Self-Learner'-badge?. This returns all your questions, where you have added a self-answer with a score of 2 or higher.
### Response:
|
SELECT a.ParentId AS "Question Id", a.Score AS "Answer Score", b.Title AS "Question Title" FROM Posts AS a INNER JOIN Posts AS b ON b.Id = a.ParentId WHERE a.OwnerUserId = '##UserId##' AND a.PostTypeId = 2 AND b.OwnerUserId = a.OwnerUserId AND a.Score > 2
|
### Instruction:
have any microbiology test been performed on their first hospital encounter for patient 031-3355?
### 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 NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1))
|
### Instruction:
who publishes in Multiuser Receiver for Decision Feedback
### Response:
|
SELECT DISTINCT writes.authorid FROM keyphrase, paper, paperkeyphrase, writes WHERE keyphrase.keyphrasename IN ('Multiuser Receiver', 'Decision Feedback') AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid AND writes.paperid = paper.paperid GROUP BY writes.authorid HAVING COUNT(DISTINCT keyphrase.keyphrasename) > 1
|
### Instruction:
what's the total output that patient 92846 has had today?
### Response:
|
SELECT SUM(outputevents.value) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 92846)) AND DATETIME(outputevents.charttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day')
|
### Instruction:
How many patients with left internal jugular vein thrombosis left arm edema as their primary disease had continuous invasive mechanical ventilation for 96 consecutive hours or more?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "LEFT INTERNAL JUGULAR VEIN THROMBOSIS;LEFT ARM EDEMA" AND procedures.short_title = "Cont inv mec ven 96+ hrs"
|
### Instruction:
can i get a TAXI from LONG BEACH airport to downtown LONG BEACH
### Response:
|
SELECT DISTINCT ground_service.transport_type FROM airport, airport_service, city, ground_service WHERE airport.airport_code = airport_service.airport_code AND city.city_code = airport_service.city_code AND city.city_name = 'LONG BEACH' AND ground_service.airport_code = airport.airport_code AND ground_service.transport_type = 'TAXI'
|
### Instruction:
what was the name of the specimen test that patient 61683 had received the first time until 09/2104?
### Response:
|
SELECT microbiologyevents.spec_type_desc FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 61683) AND STRFTIME('%y-%m', microbiologyevents.charttime) <= '2104-09' ORDER BY microbiologyevents.charttime LIMIT 1
|
### Instruction:
what is the top three most frequent output events the last year?
### Response:
|
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT t1.itemid FROM (SELECT outputevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM outputevents WHERE DATETIME(outputevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY outputevents.itemid) AS t1 WHERE t1.c1 <= 3)
|
### Instruction:
Number of posts for users last seen X months ago.
### Response:
|
SELECT Months AS "Months since user last seen", Posts AS "Posts at exactly", SUM(Posts) OVER (ORDER BY Months DESC) AS "Posts at or before" FROM (SELECT DATEDIFF(mm, Users.LastAccessDate, GETDATE()) AS "Months", COUNT(*) AS "Posts" FROM Users INNER JOIN Posts ON Posts.OwnerUserId = Users.Id GROUP BY DATEDIFF(mm, Users.LastAccessDate, GETDATE())) AS preliminary ORDER BY Months
|
### Instruction:
who does chasins work with ?
### 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 = 'chasins' AND WRITES_0.authorid = AUTHOR_0.authorid AND WRITES_1.authorid = AUTHOR_1.authorid AND WRITES_1.paperid = WRITES_0.paperid
|
### Instruction:
give me the number of patients whose diagnoses long title is transient neonatal thrombocytopenia and drug type is additive?
### 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 = "Transient neonatal thrombocytopenia" AND prescriptions.drug_type = "ADDITIVE"
|
### Instruction:
% questions asked by new account users.
### Response:
|
SELECT CAST((SELECT COUNT(1) FROM Posts AS p JOIN Users AS u ON p.OwnerUserId = u.Id WHERE CAST(TIME_TO_STR(p.CreationDate, '%Y%m%d') AS TEXT(30)) = CAST(TIME_TO_STR(u.CreationDate, '%Y%m%d') AS TEXT(30))) AS FLOAT) / CAST((SELECT COUNT(1) FROM Posts) AS FLOAT) * 100.0
|
### Instruction:
For the Core requirement , what Social Organization of Black Communities courses are offered ?
### Response:
|
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN area ON course.course_id = area.course_id INNER JOIN program_course ON program_course.course_id = course.course_id WHERE (area.area LIKE '%Social Organization of Black Communities%' OR course.description LIKE '%Social Organization of Black Communities%' OR course.name LIKE '%Social Organization of Black Communities%') AND program_course.category LIKE '%Core%'
|
### Instruction:
give me the number of patients whose gender is f 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.gender = "F" AND demographic.diagnosis = "NEOPLASM OF UNCERTAIN BEHAVIOR OF OTHER LYMPHATIC AND HEMATOPOIETIC TISSUES\BONE MARROW TRANSPLANT"
|
### Instruction:
was patient 028-52605 given a diagnosis until 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-52605')) AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CURRENT_TIME(), '-1 year')
|
### Instruction:
Answers with the lowest score.
### Response:
|
SELECT r.Score AS rRep, q.Score AS qRep, 'http://scifi.stackexchange.com/a/' + CAST(r.Id AS TEXT) + '/4918|' + q.Title AS link, q.Tags AS tags, COALESCE(r.LastEditDate, r.CreationDate) AS rDate FROM Posts AS r, Posts AS q WHERE q.Id = r.ParentId AND r.PostTypeId = 2 AND r.Score < -10 ORDER BY rRep
|
### Instruction:
had patient 011-31236 ever had a respiration of greater than 27.0?
### Response:
|
SELECT COUNT(*) > 0 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '011-31236')) AND vitalperiodic.respiration > 27.0 AND NOT vitalperiodic.respiration IS NULL
|
### Instruction:
What was the Population (2011) when the Population (2006) was less than 7083, and the Population density less than 342.8, and the Change (%) of 5, and an Area (km ) larger than 4.5?
### Response:
|
SELECT COUNT(population__2011_) FROM table_name_2 WHERE population__2006_ < 7083 AND population_density < 342.8 AND change___percentage_ = 5 AND area__km²_ > 4.5
|
### Instruction:
Most recent comments on answers in a given tag.
### Response:
|
SELECT c.UserId AS "user_link", c.CreationDate, c.Id AS "comment_link", c.PostId AS "post_link", c.Text FROM Comments AS c JOIN Posts AS p ON c.PostId = p.Id JOIN Posts AS q ON p.ParentId = q.Id WHERE (p.PostTypeId = 2) AND (q.Tags LIKE '%<##tagName?gn.general-topology##>%') ORDER BY CreationDate DESC LIMIT 500
|
### Instruction:
what are the five most frequent output event during a year before?
### Response:
|
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT t1.itemid FROM (SELECT outputevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM outputevents WHERE DATETIME(outputevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY outputevents.itemid) AS t1 WHERE t1.c1 <= 5)
|
### Instruction:
Earliest Multiuser Receiver paper with Decision Feedback
### Response:
|
SELECT DISTINCT paper.paperid, paper.year FROM keyphrase, paper, paperkeyphrase WHERE keyphrase.keyphrasename IN ('Multiuser Receiver', 'Decision Feedback') AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid GROUP BY paper.paperid, paper.year HAVING COUNT(DISTINCT keyphrase.keyphrasename) > 1 ORDER BY paper.year
|
### Instruction:
What is the sum of the values for N, Laakso-Taagepera, when Largest Component, Fractional Share is 0.35000000000000003, and when Constellation is E?
### Response:
|
SELECT SUM("N, Laakso-Taagepera") FROM table_43953 WHERE "Largest component, fractional share" = '0.35000000000000003' AND "Constellation" = 'e'
|
### Instruction:
Provide the number of patients who had other closed [endoscopic] biopsy of biliary duct or sphincter of oddi and were born before 2060.
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dob_year < "2060" AND procedures.long_title = "Other closed [endoscopic] biopsy of biliary duct or sphincter of Oddi"
|
### Instruction:
just how many magnesium sulfate 4 gram/100 ml iv piggy back : 100 ml flex cont prescriptions were there during a year before?
### Response:
|
SELECT COUNT(*) FROM medication WHERE medication.drugname = 'magnesium sulfate 4 gram/100 ml iv piggy back : 100 ml flex cont' AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')
|
### Instruction:
provide the number of patients on nifedipine medication who have been diagnosed with primary malignant neoplasm of liver.
### 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 = "Malignant neoplasm of liver, primary" AND prescriptions.drug = "NIFEdipine"
|
### Instruction:
count the number of drugs prescribed on the last hospital visit for patient 021-141335.
### 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 = '021-141335' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1))
|
### Instruction:
What is the sum of P desc with a P 2007 of 0,00 and a P, Ap 2008 less than 30,00, and a P CL 2008 that is more than 10,56?
### Response:
|
SELECT SUM("P desc") FROM table_59239 WHERE "P 2007" = '0,00' AND "P Ap 2008" < '30,00' AND "P Cl 2008" > '10,56'
|
### Instruction:
Find the name of amenities of the dorm where the student with last name Smith is living in.
### Response:
|
SELECT T3.amenity_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid JOIN lives_in AS T4 ON T4.dormid = T1.dormid JOIN student AS T5 ON T5.stuid = T4.stuid WHERE T5.lname = 'Smith'
|
### Instruction:
whats the last height of patient 005-80291 until 10/2105?
### Response:
|
SELECT patient.admissionheight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-80291') AND NOT patient.admissionheight IS NULL AND STRFTIME('%y-%m', patient.unitadmittime) <= '2105-10' ORDER BY patient.unitadmittime DESC LIMIT 1
|
### 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 bar chart about the distribution of hire_date and the amount of hire_date bin hire_date by time.
### Response:
|
SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40
|
### Instruction:
show me the number of patients on additive type drug prescription who have a diagnoses of personal history of malignant neoplasm of bladder.
### 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.short_title = "Hx of bladder malignancy" AND prescriptions.drug_type = "ADDITIVE"
|
### Instruction:
Provide the number of patients on additive type drug prescription who have other pulmonary insufficiency not elsewhere classified diagnoses.
### 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 = "Other pulmonary insufficiency, not elsewhere classified" AND prescriptions.drug_type = "ADDITIVE"
|
### Instruction:
What was the latitude for van meter who had a land(sqmi) larger than 35.747, Water(sqmi) of 0 and a GEO ID smaller than 3809981860?
### Response:
|
SELECT COUNT("Latitude") FROM table_63457 WHERE "Land ( sqmi )" > '35.747' AND "Water (sqmi)" = '0' AND "GEO ID" < '3809981860' AND "Township" = 'van meter'
|
### Instruction:
provide the number of patients whose diagnoses short title is abn react-surg proc nec and lab test fluid is cerebrospinal fluid (csf)?
### 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.short_title = "Abn react-surg proc NEC" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
|
### Instruction:
patient 013-23115 has any disease diagnosed since 6 years 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 = '013-23115')) AND DATETIME(diagnosis.diagnosistime) >= DATETIME(CURRENT_TIME(), '-6 year')
|
### Instruction:
who does chasins author with ?
### 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 = 'chasins' AND WRITES_0.authorid = AUTHOR_0.authorid AND WRITES_1.authorid = AUTHOR_1.authorid AND WRITES_1.paperid = WRITES_0.paperid
|
### Instruction:
what is the top four most frequent output events during this year?
### Response:
|
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT t1.itemid FROM (SELECT outputevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM outputevents WHERE DATETIME(outputevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY outputevents.itemid) AS t1 WHERE t1.c1 <= 4)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.