instruction
stringlengths 57
490
| output
stringlengths 69
1.29k
|
---|---|
### Instruction:
Give me the number of patients diagnosed with type 1 diabetes with renal manifestations that were not stated as uncontrolled who had vasopressor infusion.
### 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 = "DMI renl nt st uncntrld" AND procedures.short_title = "Infusion of vasopressor" |
### 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:
What is Cabinet, when Year is before 2001, when Lijsttrekker is 'No Elections', when Fractievoorzitter is 'Hans Van Mierlo', and when Chair is 'S. Van Der Loo'?
### Response:
| SELECT "Cabinet" FROM table_9585 WHERE "Year" < '2001' AND "Lijsttrekker" = 'no elections' AND "Fractievoorzitter" = 'hans van mierlo' AND "Chair" = 's. van der loo' |
### Instruction:
Can you list the JUDAIC classes that don 't meet on Friday ?
### 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_offering.friday = 'N' AND course.department = 'JUDAIC' AND semester.semester = 'WN' AND semester.year = 2016 |
### Instruction:
provide the number of patients diagnosed with other and unspecified hyperlipidemia who had central venous catheter placement with guidance.
### 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.long_title = "Other and unspecified hyperlipidemia" AND procedures.long_title = "Central venous catheter placement with guidance" |
### Instruction:
Most viewed questions with a tag converted to a synonym since then.
### Response:
| SELECT Posts.Id AS "post_link", Posts.ViewCount, TagSynonyms.SourceTagName AS "Its tag...", TagSynonyms.TargetTagName AS "...is a synonym of" FROM TagSynonyms, Tags, PostTags, Posts WHERE Tags.TagName = TagSynonyms.SourceTagName AND PostTags.TagId = Tags.Id AND Posts.Id = PostTags.PostId ORDER BY Posts.ViewCount DESC, Posts.Id DESC LIMIT 100 |
### Instruction:
until 31 months ago, what was the first drug patient 1704 was prescribed via the po/ng route?
### Response:
| SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1704) AND prescriptions.route = 'po/ng' AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-31 month') ORDER BY prescriptions.startdate LIMIT 1 |
### Instruction:
Collect aggregate results for users.
### Response:
| SELECT u.Id, u.Reputation, (SELECT COUNT(*) FROM Votes WHERE VoteTypeId IN (2, 3) AND PostId IN (SELECT Id FROM Posts WHERE PostTypeId = 1 AND OwnerUserId = u.Id)) AS "aggregate_number_of_votes_received_on_questions" FROM Users AS u WHERE u.Id IN (83, 2926, 3289, 5862, 6292, 8705) |
### Instruction:
Average total score of users depending on number of posts.
### Response:
| WITH postgroups_cte AS (SELECT u.Id AS uid, SUM(p.Score) AS sco, CAST(COUNT(p.Id) / '##mult?100##' AS INT) AS pgroup FROM Users AS u INNER JOIN Posts AS p ON p.OwnerUserId = u.Id GROUP BY u.Id) SELECT pgroup, AVG(CAST(sco AS FLOAT)) AS Average FROM postgroups_cte GROUP BY pgroup ORDER BY pgroup DESC |
### Instruction:
when was the first time patient 72107 had dextrose 50% prescribed on their first hospital visit?
### Response:
| SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 72107 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) AND prescriptions.drug = 'dextrose 50%' ORDER BY prescriptions.startdate LIMIT 1 |
### Instruction:
Who has taught , is teaching , or will teach RCCORE 104 ?
### Response:
| SELECT DISTINCT instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'RCCORE' AND course.number = 104 AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id |
### Instruction:
what did patient 17286 receive for his or her first procedure?
### Response:
| SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT procedures_icd.icd9_code FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 17286) ORDER BY procedures_icd.charttime LIMIT 1) |
### Instruction:
this year, what were the five most common input events?
### Response:
| SELECT t1.celllabel FROM (SELECT intakeoutput.celllabel, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM intakeoutput WHERE intakeoutput.cellpath LIKE '%intake%' AND DATETIME(intakeoutput.intakeoutputtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY intakeoutput.celllabel) AS t1 WHERE t1.c1 <= 5 |
### Instruction:
Users who posted the most recent comments.
### Response:
| WITH recent_cte AS (SELECT UserId AS uid, MAX(Id) AS MaxId FROM Comments WHERE (CreationDate >= '##datemin?2018-01-01##') GROUP BY UserId) SELECT uid AS "user_link", c.CreationDate, MaxId AS "comment_link", c.PostId AS "post_link", c.Text FROM recent_cte INNER JOIN Comments AS c ON MaxId = c.Id ORDER BY c.CreationDate DESC |
### Instruction:
what's the five most frequent input event since 2105?
### 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 STRFTIME('%y', inputevents_cv.charttime) >= '2105' GROUP BY inputevents_cv.itemid) AS t1 WHERE t1.c1 <= 5) |
### Instruction:
subjects between the ages of 18 and 65 years, inclusive, with a body mass index ( bmi ) of 18.5 to 45 kg / m2 and c _ peptide > 0.8 ng / ml.
### Response:
| SELECT * FROM table_dev_54 WHERE (age >= 18 AND age <= 65) AND (body_mass_index_bmi >= 18.5 AND body_mass_index_bmi <= 45 AND c_peptide_level > 0.8) |
### Instruction:
provide the number of patients whose diagnoses icd9 code is v4281 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.icd9_code = "V4281" AND lab.fluid = "Cerebrospinal Fluid (CSF)" |
### Instruction:
when did patient 013-30085 get a lab test for the first time on their current hospital visit?
### Response:
| SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-30085' AND patient.hospitaldischargetime IS NULL)) ORDER BY lab.labresulttime LIMIT 1 |
### Instruction:
provide the number of patients whose primary disease is squamous cell carcinoma oral tongue/sda and procedure short title is opn mitral valvuloplasty?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "SQUAMOUS CELL CARCINOMA ORAL TONGUE/SDA" AND procedures.short_title = "Opn mitral valvuloplasty" |
### Instruction:
tell me the last test that patient 29806 had received on their first hospital visit?
### 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 = 29806 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) ORDER BY labevents.charttime DESC LIMIT 1) |
### Instruction:
count the number of patients whose admission locations is phys referral/normal deli and diagnosis long title is diverticulitis of colon (without mention of hemorrhage).
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND diagnoses.long_title = "Diverticulitis of colon (without mention of hemorrhage)" |
### Instruction:
what is the average number of yearly diagnosed cases of hypoxemia until 4 years ago?
### Response:
| SELECT AVG(t1.c1) FROM (SELECT COUNT(DISTINCT diagnosis.patientunitstayid) AS c1 FROM diagnosis WHERE diagnosis.diagnosisname = 'hypoxemia' AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CURRENT_TIME(), '-4 year') GROUP BY STRFTIME('%y', diagnosis.diagnosistime)) AS t1 |
### Instruction:
how many hours have passed since last time that patient 021-111547 stayed in ward 814 in this hospital visit?
### Response:
| SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '021-111547' AND patient.wardid = 814 AND patient.hospitaldischargetime IS NULL ORDER BY patient.unitadmittime DESC LIMIT 1 |
### Instruction:
how long was patient 011-54801's first hospital stay in the icu?
### Response:
| SELECT STRFTIME('%j', patient.unitdischargetime) - STRFTIME('%j', patient.unitadmittime) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '011-54801') AND NOT patient.unitadmittime IS NULL ORDER BY patient.unitadmittime LIMIT 1 |
### Instruction:
what's the number of patients who had a pantoprazole (ns)-in intake until 2104?
### Response:
| SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT intakeoutput.patientunitstayid FROM intakeoutput WHERE intakeoutput.celllabel = 'pantoprazole (ns)-in' AND intakeoutput.cellpath LIKE '%input%' AND STRFTIME('%y', intakeoutput.intakeoutputtime) <= '2104') |
### Instruction:
What is the lowest number of members on the Cultural and Educational Panel, when the University of Dublin had 3 members, when the Industrial and Commercial Panel had more than 0 members, and when the Agricultural Panel had more than 4 members?
### Response:
| SELECT MIN("Cultural and Educational Panel") FROM table_40908 WHERE "University of Dublin" < '3' AND "Industrial and Commercial Panel" > '0' AND "Agricultural Panel" > '4' |
### Instruction:
tell me the number of times a extracorporeal circulat procedure was done until 1 year ago?
### Response:
| SELECT COUNT(*) FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'extracorporeal circulat') AND DATETIME(procedures_icd.charttime) <= DATETIME(CURRENT_TIME(), '-1 year') |
### Instruction:
Extract accepted and most-voted answer of a question.
### Response:
| SELECT * FROM (SELECT Id, Body, Score, DENSE_RANK() OVER (ORDER BY Score DESC) AS Rank FROM (SELECT a.Id, a.ParentId, a.Body, a.Score FROM Posts AS a WHERE a.ParentId = '##QuestionId##') AS x LIMIT 2) AS x WHERE (SELECT q.AcceptedAnswerId FROM Posts AS q WHERE q.Id = '##QuestionId##') = Id OR Rank = 1 |
### Instruction:
Lists users in descending order of number of rollback edits they've done.. Lists users in descending order of number of rollback edits they've done.
### Response:
| SELECT r.UserId AS "user_link", COUNT(*) AS "Count" FROM (SELECT h.UserId FROM PostHistory AS h WHERE h.PostHistoryTypeId IN (7, 8, 9) AND NOT h.UserId IS NULL GROUP BY h.UserId, h.RevisionGUID) AS r GROUP BY r.UserId ORDER BY 'Count' DESC |
### Instruction:
what is the number of patients whose primary disease is st elevated myocardial infarction\cardiac cath and procedure icd9 code is 9465?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "ST ELEVATED MYOCARDIAL INFARCTION\CARDIAC CATH" AND procedures.icd9_code = "9465" |
### Instruction:
When critical altitude is sea level, what is the compression ration for a supercharger gear ratio of 7:1?
### Response:
| SELECT "Compression ratio" FROM table_16551 WHERE "Critical altitude This is the highest altitude at which the engine can achieve its full continuous power rating. Above this altitude, power falls off with height as with a naturally aspirated engine . See Supercharger#Altitude effects for details." = 'sea level' AND "Supercharger gear ratio" = '7:1' |
### Instruction:
how many patients who are diagnosed with short title encephalopathy nos have been prescibed additive type of drug?
### 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 = "Encephalopathy NOS" AND prescriptions.drug_type = "ADDITIVE" |
### Instruction:
what is the total bag dose that until 51 months ago patient 27591 has been prescribed?
### Response:
| SELECT SUM(prescriptions.dose_val_rx) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 27591) AND prescriptions.drug = 'bag' AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-51 month') |
### Instruction:
What is the venue of the competition '1994 FIFA World Cup qualification' hosted by 'Nanjing ( Jiangsu )'?
### Response:
| SELECT T3.venue FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city JOIN match AS T3 ON T2.match_id = T3.match_id WHERE T1.city = "Nanjing ( Jiangsu )" AND T3.competition = "1994 FIFA World Cup qualification" |
### Instruction:
Find number of Unanswered Questions on SO (questions with no answers at all). Counts the number of unanswered questions on SO, that are not community-wiki, not closed and have no accepted answer.
### Response:
| SELECT q.Id, q.ViewCount, q.Title FROM Posts AS q WHERE (SELECT COUNT(*) FROM Posts AS a WHERE a.ParentId = q.Id) = 0 AND CommunityOwnedDate IS NULL AND ClosedDate IS NULL AND q.ParentId IS NULL AND AcceptedAnswerId IS NULL ORDER BY ViewCount DESC |
### Instruction:
What are the number of the payment dates for any payments that have an amount greater than 10 or were handled by a staff member with the first name Elsa?, and show by the total number in asc please.
### Response:
| SELECT payment_date, COUNT(payment_date) FROM payment WHERE amount > 10 UNION SELECT T1.payment_date FROM payment AS T1 JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Elsa' ORDER BY COUNT(payment_date) |
### Instruction:
for the anal fistulotomy what does it cost?
### Response:
| SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'procedures_icd' AND cost.event_id IN (SELECT procedures_icd.row_id FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'anal fistulotomy')) |
### Instruction:
Most downvoted posts without a single (non-owner) comment.
### Response:
| SELECT Posts.Id AS "post_link", Posts.OwnerUserId AS "user_link", Posts.Score FROM Posts LEFT JOIN Comments ON Comments.PostId = Posts.Id AND Comments.UserId != Posts.OwnerUserId AND Comments.UserId > 1 WHERE Comments.Id IS NULL AND Posts.OwnerUserId > 1 AND Posts.Score < 0 ORDER BY Posts.Score, Posts.Id |
### Instruction:
provide the number of patients whose diagnoses short title is chrnc hpt c wo hpat coma and drug type is main?
### 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 = "Chrnc hpt C wo hpat coma" AND prescriptions.drug_type = "MAIN" |
### Instruction:
Amount of users who's last activity was during that month.
### Response:
| SELECT Month = DATEADD(MONTH, DATEDIFF(MONTH, 0, Last_activity), 0), 'Lost members' = COUNT(activity.UserId) FROM (SELECT UserId, Last_activity = MAX(Date) FROM Badges INNER JOIN Users ON Badges.UserId = Users.Id GROUP BY UserId) AS activity GROUP BY DATEADD(MONTH, DATEDIFF(MONTH, 0, Last_activity), 0) ORDER BY Month |
### Instruction:
provide the number of patients whose diagnoses short title is subtrochanteric fx-close and drug route is left eye?
### 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 = "Subtrochanteric fx-close" AND prescriptions.route = "LEFT EYE" |
### 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 phone_number and department_id , I want to rank from high to low by the Y please.
### Response:
| SELECT PHONE_NUMBER, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY DEPARTMENT_ID DESC |
### Instruction:
For those employees who do not work in departments with managers that have ids between 100 and 200, find last_name and department_id , and visualize them by a bar chart, and rank by the y axis from high to low please.
### Response:
| SELECT LAST_NAME, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY DEPARTMENT_ID DESC |
### Instruction:
% of questions edited after close (graph based on Date Closed).
### Response:
| SELECT LAST_DATE_OF_MONTH(ClosedDate) AS Closed, 1.0 * SUM(CASE WHEN LastEditDate > ClosedDate THEN 1 ELSE 0 END) / COUNT(*) AS "%edit_after_close" FROM Posts WHERE NOT ClosedDate IS NULL AND PostTypeId = 1 GROUP BY LAST_DATE_OF_MONTH(ClosedDate) ORDER BY LAST_DATE_OF_MONTH(ClosedDate) |
### Instruction:
Name the courses taught by Prof. Bradley Moore .
### 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 instructor.name LIKE '%Bradley Moore%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id |
### Instruction:
count the number of times patient 025-30850 had received endotracheal tube - insertion.
### 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 = '025-30850')) AND treatment.treatmentname = 'endotracheal tube - insertion' |
### Instruction:
whats the unabbreviated version of tb lung cavity-exam unkn.
### Response:
| SELECT d_icd_diagnoses.long_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'tb lung cavity-exam unkn' UNION SELECT d_icd_procedures.long_title FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'tb lung cavity-exam unkn' |
### Instruction:
count the number of visits to the intensive care unit of patient 021-139760 in 2102.
### Response:
| SELECT COUNT(DISTINCT patient.patientunitstayid) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-139760') AND STRFTIME('%y', patient.unitadmittime) = '2102' |
### Instruction:
what is the number of patients on main type of drug prescription who have the diagnoses of other respiratory problems after birth?
### 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 respiratory problems after birth" AND prescriptions.drug_type = "MAIN" |
### Instruction:
What is the area in km2 for Cape Agulhas, whose density is larger than 9.4 inhabitants/km2 and whose population in 2011 was less than 33,038?
### Response:
| SELECT MAX("Area (km 2 )") FROM table_8973 WHERE "Density (inhabitants/km 2 )" > '9.4' AND "Name" = 'cape agulhas' AND "Population (2011)" < '33,038' |
### Instruction:
top 200 french users using nodejs.
### Response:
| SELECT Id AS "user_link", Reputation, WebsiteUrl, Location FROM Users AS usrr JOIN (SELECT usr.Id AS userId FROM Users AS usr JOIN Posts AS post ON usr.Id = post.OwnerUserId WHERE usr.Location LIKE '%India%' AND post.Tags LIKE '%node.js%' GROUP BY usr.Id) AS sub ON usrr.Id = sub.userId ORDER BY usrr.Reputation DESC LIMIT 200 |
### Instruction:
how may patients below 83 years of age are diagnosed with personal history of malignant neoplasm of gastrointestinal tract, unspecified?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "83" AND diagnoses.long_title = "Personal history of malignant neoplasm of gastrointestinal tract, unspecified" |
### Instruction:
A bar chart for what are the number of the completion dates of all the tests that have result 'Fail'?, and I want to sort in ascending by the y-axis.
### Response:
| SELECT date_of_completion, COUNT(date_of_completion) FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Fail" ORDER BY COUNT(date_of_completion) |
### Instruction:
how many patients are primary diagnosed for femoral artery thrombosis and used sodium chloride 0.9% flush?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.diagnosis = "FEMORAL ARTERY THROMBOSIS" AND prescriptions.drug = "Sodium Chloride 0.9% Flush" |
### Instruction:
questions tagged qt over the years.
### Response:
| SELECT YEAR(CreationDate) AS "year", SUM(CASE WHEN PostHistoryTypeId = 3 THEN 1 ELSE 0 END) AS InitialTags, SUM(CASE WHEN PostHistoryTypeId = 6 THEN 1 ELSE 0 END) AS EditedTags, SUM(1) AS TotalQuestionsWithTag FROM PostHistory WHERE PostHistoryTypeId IN (3, 6) AND 'text' LIKE '%<##tag##>%' GROUP BY YEAR(CreationDate) |
### Instruction:
calculate the length of the hospital stay of patient 16248's first icu stay.
### Response:
| SELECT STRFTIME('%j', icustays.outtime) - STRFTIME('%j', icustays.intime) FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 16248) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1 |
### Instruction:
A pie chart for finding the number of the names of stadiums that some Australian swimmers have been to.
### Response:
| SELECT T4.Name, COUNT(T4.Name) FROM swimmer AS t1 JOIN record AS t2 ON t1.ID = t2.Swimmer_ID JOIN event AS t3 ON t2.Event_ID = t3.ID JOIN stadium AS t4 ON t4.ID = t3.Stadium_ID WHERE t1.Nationality = 'Australia' GROUP BY T4.Name |
### 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 department_id over hire_date with a line chart.
### Response:
| SELECT HIRE_DATE, DEPARTMENT_ID FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 |
### Instruction:
give me the number of patients whose diagnoses icd9 code is v4364 and drug route is ivpca?
### 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.icd9_code = "V4364" AND prescriptions.route = "IVPCA" |
### Instruction:
what is the number of patients whose diagnoses icd9 code is 75732 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.icd9_code = "75732" AND prescriptions.drug_type = "BASE" |
### Instruction:
What is the first name of the student whose last name starting with the letter S and is taking ACCT-211 class?
### Response:
| SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code WHERE T3.crs_code = 'ACCT-211' AND T1.stu_lname LIKE 'S%' |
### Instruction:
count the number of patients whose diagnoses icd9 code is v489 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.icd9_code = "V489" AND prescriptions.drug_type = "ADDITIVE" |
### Instruction:
For those employees who did not have any job in the past, visualize a bar chart about the distribution of job_id and the sum of employee_id , and group by attribute job_id, and sort from high to low by the total number.
### Response:
| SELECT JOB_ID, SUM(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY SUM(EMPLOYEE_ID) DESC |
### Instruction:
give me the number of patients whose diagnoses short title is ocl crtd art wo infrct and lab test abnormal status is abnormal?
### 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 = "Ocl crtd art wo infrct" AND lab.flag = "abnormal" |
### Instruction:
How many views did the question I answered get?. Finds every answer you wrote, and then looks how many views the question got. Kinda cool imo.
### Response:
| SELECT A.ParentId AS "Question ID", Q.Id AS "post_link", Q.Tags AS "Tags", Q.ViewCount AS "Views" FROM Posts AS A INNER JOIN Posts AS Q ON Q.Id = A.ParentId WHERE A.PostTypeId = 2 AND A.OwnerUserId = @UserId ORDER BY Q.ViewCount 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, what is the relationship between employee_id and commission_pct ?
### Response:
| SELECT EMPLOYEE_ID, COMMISSION_PCT FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 |
### Instruction:
what number of patients diagnosed with benign neo pituitary had drug type as 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.short_title = "Benign neo pituitary" AND prescriptions.drug_type = "ADDITIVE" |
### 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 average of department_id bin hire_date by time in a bar chart.
### Response:
| SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) |
### Instruction:
How many patients are diagnosed with noninf gastroenterit nec and received medication through oral drug route?
### 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 = "Noninf gastroenterit NEC" AND prescriptions.route = "ORAL" |
### Instruction:
when was the first time that liposomal cytarabine (depocyt) was prescribed to patient 64538?
### Response:
| SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 64538) AND prescriptions.drug = 'liposomal cytarabine (depocyt)' ORDER BY prescriptions.startdate LIMIT 1 |
### Instruction:
tell me the total amount of patient 31854's inputs on the current icu visit?
### 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 = 31854) AND icustays.outtime IS NULL) |
### Instruction:
For those employees who was hired before 2002-06-21, show me about the distribution of job_id and the sum of employee_id , and group by attribute job_id in a bar chart, and I want to order JOB_ID in asc order.
### Response:
| SELECT JOB_ID, SUM(EMPLOYEE_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY JOB_ID |
### Instruction:
provide the number of patients whose diagnoses icd9 code is 5679 and drug type is main?
### 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.icd9_code = "5679" AND prescriptions.drug_type = "MAIN" |
### Instruction:
Percentage of users with rep=1 and with just a single question post.
### Response:
| SELECT (1.0 * (SELECT COUNT(*) FROM (SELECT u.Id FROM (SELECT Id FROM Users WHERE Reputation = 1) AS u JOIN Posts AS p ON u.Id = p.OwnerUserId GROUP BY u.Id HAVING COUNT(*) = 1 AND MAX(p.PostTypeId) = 1) AS Chosen)) / (1.0 * (SELECT COUNT(*) FROM Users)) * 100 |
### Instruction:
Recent posts by MathOverflow moderators.
### Response:
| SELECT u.Id AS "user_link", u.LastAccessDate, p.CreationDate, p.Id AS "post_link" FROM Users AS u INNER JOIN Posts AS p ON p.OwnerUserId = u.Id WHERE u.Id IN (2, 3, 66, 121, 1409, 2000, 2926) ORDER BY p.CreationDate DESC LIMIT 100 |
### Instruction:
vba questions daily, 60 days.
### Response:
| SELECT DATEPART(ww, CreationDate) AS "week", COUNT(*) AS "vba_questions" FROM Posts WHERE Tags LIKE '%vba>%' AND PostTypeId = 1 AND CreationDate >= DATEADD(d, -60, GETDATE()) AND DATEPART(ww, CreationDate) < DATEPART(ww, GETDATE()) - 1 GROUP BY DATEPART(ww, CreationDate) ORDER BY DATEPART(ww, CreationDate) |
### Instruction:
how many patients whose diagnoses short title is malig neo ascend colon and lab test category is hematology?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Malig neo ascend colon" AND lab."CATEGORY" = "Hematology" |
### Instruction:
what was the three most frequent specimen test performed until 2103?
### Response:
| SELECT t1.culturesite FROM (SELECT microlab.culturesite, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM microlab WHERE STRFTIME('%y', microlab.culturetakentime) <= '2103' GROUP BY microlab.culturesite) AS t1 WHERE t1.c1 <= 3 |
### Instruction:
did patient 027-101472 have a alkaline phos. test?
### 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 = '027-101472')) AND lab.labname = 'alkaline phos.' |
### Instruction:
For RUSSIAN 469 , how many lecture sections are offered next semester ?
### Response:
| SELECT COUNT(*) FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'RUSSIAN' AND course.number = 469 AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016 |
### Instruction:
What are the names of catalog entries with level number 8, and count them by a bar chart, and sort x axis from low to high order.
### Response:
| SELECT catalog_entry_name, COUNT(catalog_entry_name) FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.catalog_level_number = "8" GROUP BY catalog_entry_name ORDER BY catalog_entry_name |
### Instruction:
provide the number of patients whose diagnoses long title is unspecified septicemia and lab test category is blood gas?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Unspecified septicemia" AND lab."CATEGORY" = "Blood Gas" |
### Instruction:
list the top three most common outputs in 2101?
### Response:
| SELECT t1.celllabel FROM (SELECT intakeoutput.celllabel, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM intakeoutput WHERE intakeoutput.cellpath LIKE '%output%' AND STRFTIME('%y', intakeoutput.intakeoutputtime) = '2101' GROUP BY intakeoutput.celllabel) AS t1 WHERE t1.c1 <= 3 |
### Instruction:
in the previous year, have there been any microbiology tests conducted for patient 41014?
### Response:
| SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 41014) AND DATETIME(microbiologyevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') |
### Instruction:
what are the three most commonly ordered procedures in patients aged 60 or above?
### Response:
| SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age >= 60) GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 <= 3 |
### Instruction:
During next semester , how many NEAREAST classes are being offered ?
### Response:
| SELECT COUNT(DISTINCT course_offering.course_id) FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'NEAREAST' AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016 |
### Instruction:
For those employees who did not have any job in the past, visualize a bar chart about the distribution of hire_date and the average of employee_id bin hire_date by weekday, and list in descending by the Y.
### Response:
| SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY AVG(EMPLOYEE_ID) DESC |
### Instruction:
JPA and Hibernate Questions by Year.
### Response:
| SELECT COUNT(*) AS QuestionCount, CAST(TIME_TO_STR(Posts.CreationDate, '%Y') AS INT) AS Year FROM Posts JOIN PostTags ON Posts.Id = PostTags.PostId JOIN Tags ON Tags.Id = PostTags.TagId WHERE Tags.TagName = 'hibernate' OR Tags.TagName = 'jpa' GROUP BY TIME_TO_STR(Posts.CreationDate, '%Y') ORDER BY Year DESC |
### Instruction:
how many patients whose admission location is transfer from hosp/extram and procedure long title is closed biopsy of skin and subcutaneous tissue?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND procedures.long_title = "Closed biopsy of skin and subcutaneous tissue" |
### Instruction:
For those employees who do not work in departments with managers that have ids between 100 and 200, give me the comparison about employee_id over the job_id , and sort in asc by the bar.
### Response:
| SELECT JOB_ID, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY JOB_ID |
### Instruction:
how much did the hospitalization during this year cost patient 008-40862?
### Response:
| SELECT SUM(cost.cost) FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '008-40862') AND DATETIME(cost.chargetime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') |
### Instruction:
WHAT ARE THE RACES WHEN FLAPS ARE ZERO, PODIUMS ARE LARGER THAN 0, SEASON IS 2008, AND POLE SMALLER THAN 1?
### Response:
| SELECT SUM("Races") FROM table_51171 WHERE "FLaps" = '0' AND "Podiums" > '0' AND "Season" = '2008' AND "Pole" < '1' |
### Instruction:
report the number of american indian/alaska native ethnic background patients who have diagnoses icd9 code 51881.
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND diagnoses.icd9_code = "51881" |
### Instruction:
Changes in technologies in UK.
### Response:
| SELECT DATE(CreationDate) AS "date", COUNT(*) FROM Posts WHERE PostTypeId = 1 AND (Tags LIKE '%<java>%' AND Tags LIKE '%<.net>%' AND Tags LIKE '%<node.js>%' AND Tags LIKE '%<php>%' AND Tags LIKE '%<python>%' AND Tags LIKE '%<ruby>%' AND Tags LIKE '%<wordpress>%') GROUP BY DATE(CreationDate) ORDER BY DATE(CreationDate) |
### Instruction:
show me the aircraft that CANADIAN AIRLINES uses
### Response:
| SELECT DISTINCT aircraft.basic_type FROM aircraft, airline, equipment_sequence, flight WHERE airline.airline_name LIKE 'CANADIAN AIRLINES' AND equipment_sequence.aircraft_code = aircraft.aircraft_code AND flight.aircraft_code_sequence = equipment_sequence.aircraft_code_sequence AND flight.airline_code = airline.airline_code |
### Instruction:
count the number of patients whose diagnosis short title is complete kidney transplant and drug route is replace.
### 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 = "Compl kidney transplant" AND prescriptions.route = "REPLACE" |
### Instruction:
Calculate the number of patients less than 68 years who have primary disease atrial fibrillation/thoracoscopic maze and had a bilateral/sda procedure.
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "ATRIAL FIBRILLATION\THORACOSCOPIC MAZE PROCEDURE BILATERAL/SDA" AND demographic.age < "68" |
### Instruction:
Show the church names for the weddings of all people older than 30.
### Response:
| SELECT T4.name FROM wedding AS T1 JOIN people AS T2 ON T1.male_id = T2.people_id JOIN people AS T3 ON T1.female_id = T3.people_id JOIN church AS T4 ON T4.church_id = T1.church_id WHERE T2.age > 30 OR T3.age > 30 |
### Instruction:
provide the number of patients whose ethnicity is black/haitian and diagnoses long title is personal history of antineoplastic chemotherapy?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "BLACK/HAITIAN" AND diagnoses.long_title = "Personal history of antineoplastic chemotherapy" |
### Instruction:
how many 50 ml flex cont : magnesium sulfate 4% ij soln prescriptions have been written during the previous year?
### Response:
| SELECT COUNT(*) FROM medication WHERE medication.drugname = '50 ml flex cont : magnesium sulfate 4% ij soln' AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.