instruction
stringlengths 53
549
| output
stringlengths 30
2.33k
|
---|---|
### Instruction:
What is the highest Played, when Average is less than 0.903, when 1992-93 is 25, and when 1994-1995 is greater than 38?
### Response:
| SELECT MAX("Played") FROM table_9669 WHERE "Average" < '0.903' AND "1992-93" = '25' AND "1994-1995" > '38' |
### Instruction:
let me know the number of patients with drug code ris1l for whom pleural fluid lab test order was placed.
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.formulary_drug_cd = "RIS1L" AND lab.fluid = "Pleural" |
### Instruction:
users who took a long break from posting on an SE site?. http://meta.stackexchange.com/questions/245972/how-to-find-the-users-who-took-a-long-break-from-posting-on-an-se-site#245972
### Response:
| SELECT Users.Id, Users.EmailHash, Users.WebsiteUrl FROM Users WHERE Users.CreationDate >= '##year:int##' AND Users.Location LIKE '%##location##%' |
### Instruction:
give me the number of patients whose diagnoses short title is history of tobacco use 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.short_title = "History of tobacco use" AND lab."CATEGORY" = "Blood Gas" |
### Instruction:
how many patients whose diagnoses short title is schizophrenia nos-unspec 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 = "Schizophrenia NOS-unspec" AND lab.flag = "abnormal" |
### Instruction:
what is the number of patients whose diagnoses icd9 code is 44020 and lab test fluid is joint fluid?
### 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 = "44020" AND lab.fluid = "Joint Fluid" |
### Instruction:
give the number of patients whose discharge location is long term care hospital and procedure long title is incision of vessel, lower limb arteries.
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "LONG TERM CARE HOSPITAL" AND procedures.long_title = "Incision of vessel, lower limb arteries" |
### Instruction:
until 95 months ago, had entacapone ever been prescribed to patient 7241?
### Response:
| SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 7241) AND prescriptions.drug = 'entacapone' AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-95 month') |
### Instruction:
For all employees who have the letters D or S in their first name, show me about the distribution of job_id and the average of employee_id , and group by attribute job_id in a bar chart, list by the y axis in desc.
### Response:
| SELECT JOB_ID, AVG(EMPLOYEE_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY AVG(EMPLOYEE_ID) DESC |
### Instruction:
count the number of patients who had the intake of amicar since 4 years ago.
### Response:
| SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT intakeoutput.patientunitstayid FROM intakeoutput WHERE intakeoutput.celllabel = 'amicar' AND intakeoutput.cellpath LIKE '%input%' AND DATETIME(intakeoutput.intakeoutputtime) >= DATETIME(CURRENT_TIME(), '-4 year')) |
### Instruction:
how many patients are diagnosed with syst/diast hrt fail nos and tested under chemistry lab category?
### 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 = "Syst/diast hrt fail NOS" AND lab."CATEGORY" = "Chemistry" |
### Instruction:
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, show me about the correlation between salary and manager_id in a scatter chart.
### Response:
| SELECT SALARY, MANAGER_ID FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 |
### Instruction:
count the number of patients with drug code keto15i who were admitted in hospital via clinic referral/premature.
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND prescriptions.formulary_drug_cd = "KETO15I" |
### Instruction:
how many patients are admitted urgently and diagnosed with antifungal antibiotics causing adverse effects in therapeutic use?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "URGENT" AND diagnoses.long_title = "Antifungal antibiotics causing adverse effects in therapeutic use" |
### Instruction:
how many patients whose drug code is dapt500i and lab test fluid is ascites?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.formulary_drug_cd = "DAPT500I" AND lab.fluid = "Ascites" |
### 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:
For those employees who do not work in departments with managers that have ids between 100 and 200, find last_name and salary , and visualize them by a bar chart, and show in descending by the X.
### Response:
| SELECT LAST_NAME, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY LAST_NAME DESC |
### Instruction:
count the number of patients whose discharge location is snf and primary disease is aortic insufficiency\re-do sternotomy; aortic valve replacement ?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "SNF" AND demographic.diagnosis = "AORTIC INSUFFICIENCY\RE-DO STERNOTOMY; AORTIC VALVE REPLACEMENT " |
### 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:
has patient 82132 had any anion gap lab tests done during the current hospital visit?
### Response:
| SELECT COUNT(*) > 0 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'anion gap') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 82132 AND admissions.dischtime IS NULL) |
### Instruction:
For those employees who did not have any job in the past, show me about the distribution of hire_date and the average of department_id bin hire_date by weekday in a bar chart, I want to rank by the y axis from high to low.
### Response:
| SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY AVG(DEPARTMENT_ID) DESC |
### Instruction:
provide the number of patients whose diagnosis short title is atriovent block complete 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.short_title = "Atriovent block complete" AND prescriptions.drug_type = "BASE" |
### 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:
Calculate the number of patients who had a blood test and had drug code zinc220.
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.formulary_drug_cd = "ZINC220" AND lab.fluid = "Blood" |
### Instruction:
how many patients whose diagnoses short title is hamartoses nec 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.short_title = "Hamartoses NEC" AND prescriptions.drug_type = "ADDITIVE" |
### 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:
For those employees who was hired before 2002-06-21, give me the comparison about the average of manager_id over the hire_date bin hire_date by weekday, and I want to show from low to high by the Y-axis please.
### Response:
| SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY AVG(MANAGER_ID) |
### Instruction:
subjects with a history of significant cerebrovascular disease. this will be identified by one of the following: i. history of stroke. ii. any focal signs of significant neuropathology from the neurological examination.
### Response:
| SELECT * FROM table_train_128 WHERE cerebrovascular_disease = 1 OR ((CASE WHEN stroke = 1 THEN 1 ELSE 0 END + CASE WHEN neuropathology = 1 THEN 1 ELSE 0 END) >= 1) |
### Instruction:
count the number of patients whose diagnoses icd9 code is 43401 and drug route is sl?
### 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 = "43401" AND prescriptions.route = "SL" |
### Instruction:
What are 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 count them by a line chart
### 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' GROUP BY payment_date |
### Instruction:
among patients who had a lab test of urine, how many of them were diagnosed with icd9 code 1173?
### 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 = "1173" AND lab.fluid = "Urine" |
### Instruction:
what is the number of patients whose days of hospital stay is greater than 6 and procedure long title is (aorto)coronary bypass of two coronary arteries?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "6" AND procedures.long_title = "(Aorto)coronary bypass of two coronary arteries" |
### Instruction:
What are the completion dates of all the tests that have result 'Fail', and count them by a bar chart, and display Y from high to low order.
### 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) DESC |
### Instruction:
count the number of patients whose primary disease is coronary artery disease\coronary artery bypass graft; myomectomy/sda and age is less than 67?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "CORONARY ARTERY DISEASE\CORONARY ARTERY BYPASS GRAFT; MYOMECTOMY/SDA" AND demographic.age < "67" |
### Instruction:
What was the percentage in 1980 that had less than 37.8% in 2006, more than 29.4% in 2000, and more than 18.2% in 1970?
### Response:
| SELECT MIN(1980) FROM table_name_30 WHERE 2006 < 37.8 AND 2000 > 29.4 AND 1970 > 18.2 |
### Instruction:
Show the dates of performances with attending members whose roles are 'Violin', and count them by a bar chart, and display from low to high by the Y.
### Response:
| SELECT Date, COUNT(Date) FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID WHERE T2.Role = "Violin" GROUP BY Date ORDER BY COUNT(Date) |
### Instruction:
Find the names of the customers who have order status both 'On Road' and 'Shipped'.
### Response:
| SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = "On Road" INTERSECT SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = "Shipped" |
### Instruction:
when patient 025-24306 was admitted to the hospital via the emergency department for the first time until 2104?
### Response:
| SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '025-24306' AND patient.hospitaladmitsource = 'emergency department' AND STRFTIME('%y', patient.hospitaladmittime) <= '2104' ORDER BY patient.hospitaladmittime LIMIT 1 |
### Instruction:
how many patients diagnosed with short title sec neuroendo tumor-bone have blood gas lab test category?
### 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 = "Sec neuroendo tumor-bone" AND lab."CATEGORY" = "Blood Gas" |
### Instruction:
Count the number of patients categorized under a hematology lab test who had unilateral radical neck dissection.
### 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 = "Radical neck dissection, unilateral" AND lab."CATEGORY" = "Hematology" |
### Instruction:
how many patients whose drug code is atro1i and lab test category is hematology?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.formulary_drug_cd = "ATRO1I" AND lab."CATEGORY" = "Hematology" |
### Instruction:
For all employees who have the letters D or S in their first name, give me the comparison about the average of manager_id over the job_id , and group by attribute job_id by a bar chart, and sort from low to high by the y axis please.
### Response:
| SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY AVG(MANAGER_ID) |
### Instruction:
Which courses in U S satisfy the PreMajor requirement for my schedule ?
### 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 '%U S%' OR course.description LIKE '%U S%' OR course.name LIKE '%U S%') AND program_course.category LIKE '%PreMajor%' |
### Instruction:
what is the number of patients on pb route of drug administration who are diagnosed with hypothyroidism nos?
### 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 = "Hypothyroidism NOS" AND prescriptions.route = "PB" |
### Instruction:
Highest reputation users with a specific badge.
### Response:
| SELECT RANK() OVER (ORDER BY u.Reputation DESC) AS Rank, u.Id AS "user_link", u.Reputation, COUNT(b.Id) AS "count" FROM Badges AS b INNER JOIN Users AS u ON b.UserId = u.Id WHERE (b.Name = '##name?Famous Question##') GROUP BY u.Id, u.Reputation ORDER BY u.Reputation DESC LIMIT 500 |
### Instruction:
provide the number of patients whose days of hospital stay is greater than 9 and procedure long title is initial insertion of transvenous lead [electrode] into ventricle?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "9" AND procedures.long_title = "Initial insertion of transvenous lead [electrode] into ventricle" |
### 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 many patients whose admission year is less than 2144 and diagnoses long title is dementia in conditions classified elsewhere without behavioral disturbance?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2144" AND diagnoses.long_title = "Dementia in conditions classified elsewhere without behavioral disturbance" |
### 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:
patient 030-34260 has received a diagnosis in their current hospital encounter?
### 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 = '030-34260' AND patient.hospitaldischargetime IS NULL)) |
### Instruction:
count the number of patients whose diagnoses icd9 code is 5990 and lab test fluid is other body fluid?
### 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 = "5990" AND lab.fluid = "Other Body Fluid" |
### Instruction:
give me the number of patients whose admission year is less than 2152 and diagnoses short title is bph w/o urinary obs/luts?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2152" AND diagnoses.short_title = "BPH w/o urinary obs/LUTS" |
### Instruction:
For those employees who do not work in departments with managers that have ids between 100 and 200, draw a bar chart about the distribution of hire_date and the average of salary bin hire_date by weekday.
### Response:
| SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) |
### Instruction:
What are the names of customers who have taken both Mortgage and Auto loans?
### Response:
| SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE loan_type = 'Mortgages' INTERSECT SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE loan_type = 'Auto' |
### Instruction:
how many patients whose diagnoses short title is alzheimer's disease and drug route is po/ng?
### 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 = "Alzheimer's disease" AND prescriptions.route = "PO/NG" |
### Instruction:
For all employees who have the letters D or S in their first name, draw a bar chart about the distribution of job_id and the sum of employee_id , and group by attribute job_id, and display Y-axis in descending order.
### Response:
| SELECT JOB_ID, SUM(EMPLOYEE_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY SUM(EMPLOYEE_ID) DESC |
### Instruction:
What are the most viewed questions for a given multiple tags with time range?.
### Response:
| SELECT TOP(100) AS ViewCount, Score, Tags, Id AS "post_link" FROM Posts WHERE Id IN (SELECT PostId FROM PostTags WHERE TagId IN ((SELECT Id FROM Tags WHERE TagName IN (@TagString1, @TagString2)))) AND CreationDate > GETDATE() - '##Days##' AND CreationDate < GETDATE() - '##Olddays##' ORDER BY ViewCount DESC |
### Instruction:
calculate the number of patients that had a staph aureus screen microbiology test since 2102.
### Response:
| SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT microbiologyevents.hadm_id FROM microbiologyevents WHERE microbiologyevents.spec_type_desc = 'staph aureus screen' AND STRFTIME('%y', microbiologyevents.charttime) >= '2102') |
### Instruction:
give the number of patients whose admission location is phys referral/normal deli and lab test name is lactate dehydrogenase, pleural.
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND lab.label = "Lactate Dehydrogenase, Pleural" |
### Instruction:
select * from Posts order by Score;.
### Response:
| SELECT value AS tag, COUNT(*) AS nrPosts, AVG(Score) AS avgScore FROM (SELECT Tags, Score, value FROM Posts JOIN LATERAL STRING_SPLIT(REPLACE(REPLACE(REPLACE(Tags, '><', ','), '<', ''), '>', ''), ',')) AS t1 GROUP BY value HAVING COUNT(*) > 4 ORDER BY AVG(Score) DESC |
### Instruction:
For those employees who did not have any job in the past, show me about the distribution of hire_date and the average of department_id bin hire_date by time in a bar chart, and could you display the average of department id in ascending order?
### Response:
| SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY AVG(DEPARTMENT_ID) |
### Instruction:
Find the first names and offices of all instructors who have taught some course and also find the course description.
### Response:
| SELECT T2.emp_fname, T4.prof_office, T3.crs_description 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 |
### Instruction:
how many patients whose diagnoses short title is elev transaminase/ldh and lab test fluid is other body fluid?
### 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 = "Elev transaminase/ldh" AND lab.fluid = "Other Body Fluid" |
### Instruction:
bring the number of patients with admission location as transfer from hosp/extram who have had open reduction of femur fracture with internal fixation.
### 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 = "Open reduction of fracture with internal fixation, femur" |
### Instruction:
how many patients are diagnosed for unspecified sinusitis (chronic) and tested with urine in lab?
### 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 sinusitis (chronic)" AND lab.fluid = "Urine" |
### Instruction:
Find the ids of the students who participate in Canoeing and Kayaking.
### Response:
| SELECT T1.stuid FROM participates_in AS T1 JOIN activity AS T2 ON T2.actid = T2.actid WHERE T2.activity_name = 'Canoeing' INTERSECT SELECT T1.stuid FROM participates_in AS T1 JOIN activity AS T2 ON T2.actid = T2.actid WHERE T2.activity_name = 'Kayaking' |
### Instruction:
what is the number of patients whose diagnoses short title is aortic valve disorder and lab test fluid is ascites?
### 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 = "Aortic valve disorder" AND lab.fluid = "Ascites" |
### Instruction:
Which parties have delegates in both the 'Appropriations' committee and the 'Economic Matters' committee?
### Response:
| SELECT T2.party FROM election AS T1 JOIN party AS T2 ON T1.party = T2.party_id WHERE T1.committee = "Appropriations" INTERSECT SELECT T2.party FROM election AS T1 JOIN party AS T2 ON T1.party = T2.party_id WHERE T1.committee = "Economic Matters" |
### Instruction:
Site-wide rep gain per answer score.
### Response:
| SELECT CASE WHEN Score > 50 THEN 50 ELSE Score END AS bucket, SUM(Score * 10 + CASE WHEN AcceptedAnswerId IS NULL THEN 15 ELSE 0 END) AS REP FROM Posts WHERE PostTypeId = 2 AND Score >= 0 GROUP BY CASE WHEN Score > 50 THEN 50 ELSE Score END ORDER BY CASE WHEN Score > 50 THEN 50 ELSE Score END |
### Instruction:
top author in syntactic parsing
### Response:
| SELECT DISTINCT COUNT(paper.paperid), writes.authorid FROM keyphrase, paper, paperkeyphrase, writes WHERE keyphrase.keyphrasename = 'syntactic parsing' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid AND writes.paperid = paper.paperid GROUP BY writes.authorid ORDER BY COUNT(paper.paperid) DESC |
### Instruction:
What is the average jersey # that has a position of c, new york rangers as the 1983-1984 team, and a height (cm) greater than 188?
### Response:
| SELECT AVG("Jersey #") FROM table_7370 WHERE "Position" = 'c' AND "1983\u20131984 Team" = 'new york rangers' AND "Height (cm)" > '188' |
### Instruction:
Perguntas de Score Baixo & Respostas de Score Alto.
### Response:
| SELECT P.Id AS "post_link", P.Score AS "SCORE PERG.", A.Score AS "SCORE RESP." FROM Posts AS P JOIN (SELECT Id, Score FROM Posts GROUP BY Id, Score) AS A ON P.AcceptedAnswerId = A.Id WHERE P.Score < @ScoreBaixo AND A.Score > @ScoreAlto |
### Instruction:
what was the name of the lab test that patient 010-17950 received for the last time?
### 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-17950')) ORDER BY lab.labresulttime DESC LIMIT 1 |
### Instruction:
what is the average specific impulse for engines that have a SFC in lb/(lbf h) of 7.95, and a Effective exhaust velocity (m/s) larger than 4,423
### Response:
| SELECT AVG("Specific impulse (s)") FROM table_46803 WHERE "SFC in lb/(lbf\u00b7h)" = '7.95' AND "Effective exhaust velocity (m/s)" > '4,423' |
### 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:
Is 583 offered in the next 2 years ?
### Response:
| SELECT DISTINCT semester.semester, semester.year FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number = 583 AND semester.semester_id = course_offering.semester AND semester.year IN (2016, 2017) |
### Instruction:
how many patients are diagnosed with icd9 code 43401 and tested in lab for joint fluid?
### 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 = "43401" AND lab.fluid = "Joint Fluid" |
### 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:
Top SO users in Turkey.
### Response:
| SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS Rank, Reputation, CreationDate, DisplayName, LastAccessDate, WebsiteUrl, Location, AboutMe FROM Users WHERE (LOWER(Location) LIKE '%turke%' OR LOWER(Location) LIKE '%t rki%' OR UPPER(Location) LIKE '%Turke%' OR UPPER(Location) LIKE '%T rki%') ORDER BY Reputation DESC LIMIT 100 |
### 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') |
### Instruction:
what is the last ward identifier of patient 29540 until 2104?
### Response:
| SELECT transfers.wardid FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 29540) AND NOT transfers.wardid IS NULL AND STRFTIME('%y', transfers.intime) <= '2104' ORDER BY transfers.intime DESC LIMIT 1 |
### Instruction:
For those employees who did not have any job in the past, show me about the distribution of job_id and the average of employee_id , and group by attribute job_id in a bar chart, and order from low to high by the names please.
### Response:
| SELECT JOB_ID, AVG(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY JOB_ID |
### Instruction:
what is the average age for each dorm and what are the names of each dorm?, and show by the Y from high to low.
### Response:
| SELECT dorm_name, AVG(T1.Age) FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid GROUP BY T3.dorm_name ORDER BY AVG(T1.Age) DESC |
### Instruction:
give me the number of patients whose diagnoses short title is other pulmonary insuff and drug route is pr?
### 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 = "Other pulmonary insuff" AND prescriptions.route = "PR" |
### Instruction:
What are the names and sum of checking and savings balances for accounts with savings balances higher than the average savings balance?
### Response:
| SELECT T1.name, T2.balance + T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid WHERE T3.balance > (SELECT AVG(balance) FROM savings) |
Subsets and Splits