instruction
stringlengths 37
754
| output
stringlengths 9
3.43k
|
---|---|
### Instruction:
calculate the number of patients with unspecified opioid type dependence who received drug via ivpca 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.long_title = "Opioid type dependence, unspecified" AND prescriptions.route = "IVPCA"
|
### Instruction:
App Engine questions by month.
### Response:
|
SELECT PostMonth, COUNT(DISTINCT PostNumber) FROM (SELECT DATEADD(month, DATEDIFF(month, 0, CreationDate), 0) AS PostMonth, Posts.Id AS PostNumber FROM Posts INNER JOIN PostTags ON Posts.Id = PostTags.PostId INNER JOIN Tags ON PostTags.TagId = Tags.Id WHERE Tags.TagName = 'google-chrome' AND Posts.ParentId IS NULL) AS MonthOfPost GROUP BY PostMonth
|
### Instruction:
For those employees who was hired before 2002-06-21, visualize a bar chart about the distribution of job_id and the sum of manager_id , and group by attribute job_id, list total number of manager id in ascending order please.
### Response:
|
SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY SUM(MANAGER_ID)
|
### Instruction:
What is the total number of the 1978 Veteran membership that has a late 1943 more than 78,000 and a september 1943 larger than 60,000?
### Response:
|
SELECT COUNT("1978 Veteran membership") FROM table_54186 WHERE "Late 1943" > '78,000' AND "Sept. 1943" > '60,000'
|
### Instruction:
count the number of patients who had received a microbiological test of the stem cell - blood culture until 2103.
### 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 = 'stem cell - blood culture' AND STRFTIME('%y', microbiologyevents.charttime) <= '2103')
|
### 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 job_id and salary in a bar chart, and sort x axis from high to low order.
### Response:
|
SELECT JOB_ID, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY JOB_ID DESC
|
### Instruction:
get the number of patients who take drug via ed route and have diagnoses icd9 code 56212.
### 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 = "56212" AND prescriptions.route = "ED"
|
### Instruction:
For those employees who was hired before 2002-06-21, give me the comparison about the average of department_id over the job_id , and group by attribute job_id by a bar chart, and show total number in ascending order.
### Response:
|
SELECT JOB_ID, AVG(DEPARTMENT_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY AVG(DEPARTMENT_ID)
|
### Instruction:
when was the last time patient 2498 got the prescription in 08/2104?
### Response:
|
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 2498) AND STRFTIME('%y-%m', prescriptions.startdate) = '2104-08' ORDER BY prescriptions.startdate DESC LIMIT 1
|
### Instruction:
provide the number of patients whose diagnosis icd9 code is 6824 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.icd9_code = "6824" AND lab."CATEGORY" = "Blood Gas"
|
### Instruction:
What is the minimum age of patients whose primary disease is pneumonia;human immunodeficiency virus but not tuberculosis and were admitted in or after the year 2176?
### Response:
|
SELECT MIN(demographic.age) FROM demographic WHERE demographic.diagnosis = "PNEUMONIA;HUMAN IMMUNODEFIENCY VIRUS;RULE OUT TUBERCULOSIS" AND demographic.admityear >= "2176"
|
### Instruction:
When 1990-1995 > 0.37, 2000-2005 of 1.37, what's the highest for 1995-2000?
### Response:
|
SELECT MAX("1995-2000") FROM table_34951 WHERE "1990-1995" > '0.37' AND "2000-2005" = '1.37'
|
### 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 first_name and salary in a bar chart, could you sort by the names in asc?
### Response:
|
SELECT FIRST_NAME, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY FIRST_NAME
|
### Instruction:
Number of tag-info edits (including deleted users).
### Response:
|
SELECT PostId, COUNT(*) FROM (SELECT h.RevisionGUID, h.PostId, h.Id, h.UserId AS "user_link", h.UserDisplayName FROM PostHistory AS h JOIN Posts AS p ON h.PostId = p.Id WHERE (p.PostTypeId IN (4, 5)) AND (h.PostHistoryTypeId IN (2, 5))) AS data GROUP BY PostId ORDER BY COUNT(*) DESC
|
### Instruction:
when did the first hospital admission time that patient 83038 had been admitted via phys referral/normal deli since 1 year ago?
### Response:
|
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 83038 AND admissions.admission_location = 'phys referral/normal deli' AND DATETIME(admissions.admittime) >= DATETIME(CURRENT_TIME(), '-1 year') ORDER BY admissions.admittime LIMIT 1
|
### Instruction:
provide the number of patients whose primary disease is aortic valve insuffiency\aortic valve replacement /sda and year of death is less than or equal to 2164?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "AORTIC VALVE INSUFFIENCY\AORTIC VALVE REPLACEMENT /SDA" AND demographic.dod_year <= "2164.0"
|
### Instruction:
What is the number of booking start dates of the apartments with more than 2 bedrooms for each weekday? Show me a bar chart, and display by the total number in ascending please.
### Response:
|
SELECT booking_start_date, COUNT(booking_start_date) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 2 ORDER BY COUNT(booking_start_date)
|
### Instruction:
how many patients with 29-30 completed weeks of gestation had blood gas tested by 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 = "29-30 completed weeks of gestation" AND lab."CATEGORY" = "Blood Gas"
|
### Instruction:
and what was the last time patient 30826 was prescribed medication using the po/ng route in their current hospital encounter?
### Response:
|
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 30826 AND admissions.dischtime IS NULL) AND prescriptions.route = 'po/ng' ORDER BY prescriptions.startdate DESC LIMIT 1
|
### Instruction:
Is Friday a class day for DANCE 496 ?
### Response:
|
SELECT DISTINCT course_offering.friday 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.department = 'DANCE' AND course.number = 496 AND semester.semester = 'WN' AND semester.year = 2016
|
### Instruction:
What is the average case burden with a cost per capita of $186, a Crime rate per 1,000 people of 117, and a Residents per officer larger than 736?
### Response:
|
SELECT AVG("Case burden") FROM table_14399 WHERE "Cost per capita" = '$186' AND "Crime rate per 1,000 people" = '117' AND "Residents per officer" > '736'
|
### Instruction:
Which Capstone American Culture classes satisfy the ULCS 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 '%Capstone American Culture%' OR course.description LIKE '%Capstone American Culture%' OR course.name LIKE '%Capstone American Culture%') AND program_course.category LIKE '%ULCS%'
|
### 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 salary bin hire_date by weekday in a bar chart.
### 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 start date and end date of the booking that has booked the product named 'Book collection A'?
### Response:
|
SELECT T3.booking_start_date, T3.booking_end_date FROM products_for_hire AS T1 JOIN products_booked AS T2 ON T1.product_id = T2.product_id JOIN bookings AS T3 ON T2.booking_id = T3.booking_id WHERE T1.product_name = 'Book collection A'
|
### Instruction:
What is the lowest Profits (billion $), when Market Value (billion $) is less than 201.3, when Headquarters is United States, and when Company is JPMorgan Chase?
### Response:
|
SELECT MIN("Profits (billion $)") FROM table_49283 WHERE "Market Value (billion $)" < '201.3' AND "Headquarters" = 'united states' AND "Company" = 'jpmorgan chase'
|
### Instruction:
what is the turbo when the part number is cm8062300834302bx80623i72600bxc80623i72600?
### Response:
|
SELECT turbo FROM table_name_62 WHERE part_number_s_ = "cm8062300834302bx80623i72600bxc80623i72600"
|
### Instruction:
How Popular is my name?. Inspired by MSO/q/111104/, I threw this together for the fun of it. Displays the most popular usernames and the number of users with that name. A name must have over 50 users to be counted.
### Response:
|
SELECT DisplayName AS Name, COUNT(DisplayName) AS "Number of Users With This Name" FROM Users GROUP BY DisplayName HAVING DisplayName = 'Matthias Klupsch' ORDER BY COUNT(DisplayName) DESC
|
### Instruction:
count the number of patients whose ethnicity is american indian/alaska native and diagnoses long title is unspecified erythematous condition?
### 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.long_title = "Unspecified erythematous condition"
|
### Instruction:
What are the descriptions of the service types with product price above 100, and count them by a bar chart, and rank by the y axis in asc.
### Response:
|
SELECT Service_Type_Description, COUNT(Service_Type_Description) FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code WHERE T2.Product_Price > 100 GROUP BY Service_Type_Description ORDER BY COUNT(Service_Type_Description)
|
### Instruction:
Count the number of patients less than 41 years old with coronary artery disease/coronary artery bypass graft (myomectomy/sda) as their primary disease.
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "CORONARY ARTERY DISEASE\CORONARY ARTERY BYPASS GRAFT; MYOMECTOMY/SDA" AND demographic.age < "41"
|
### Instruction:
Find questions solved by fixing typos.
### Response:
|
SELECT a.Id AS "post_link", a.Body FROM Posts AS q INNER JOIN Posts AS a ON a.Id = q.AcceptedAnswerId WHERE LENGTH(a.Body) < 200 AND q.ClosedDate IS NULL AND (LOWER(a.Body) LIKE '%typo%' OR LOWER(a.Body) LIKE '%spelled wrong%' OR LOWER(a.Body) LIKE '%spelled incorrectly%')
|
### Instruction:
provide the number of patients whose admission year is less than 2200 and procedure long title is endoscopic removal of stone(s) from biliary tract?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2200" AND procedures.long_title = "Endoscopic removal of stone(s) from biliary tract"
|
### 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 department_id , and group by attribute job_id, and could you rank by the total number of department id in asc?
### Response:
|
SELECT JOB_ID, SUM(DEPARTMENT_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY SUM(DEPARTMENT_ID)
|
### Instruction:
Top 1000 questions by tag name.
### Response:
|
SELECT Id AS "post_link", Title, Score, Tags, Body, ViewCount, CreationDate, AnswerCount, AcceptedAnswerId, PostTypeId, ClosedDate FROM Posts AS P WHERE P.Tags LIKE '%##TagName1##%' OR P.Tags LIKE '%##TagName2##%' OR P.Tags LIKE '%##TagName3##%' OR P.Tags LIKE '%##TagName4##%' ORDER BY Score DESC LIMIT 10000
|
### Instruction:
what is the number of patients with drug code paro10 and with lab test category chemistry?
### 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 = "PARO10" AND lab."CATEGORY" = "Chemistry"
|
### Instruction:
What user had a max demand charge of 1,100 and a unit/time range of h-2: off-peak (22:30-05:30)?
### Response:
|
SELECT "User" FROM table_27712 WHERE "Max. Demand Charge ( Rs. /kVA)" = '1,100' AND "Unit (kWh)/Time range" = 'H-2: Off-peak (22:30-05:30)'
|
### Instruction:
Post migrations by destination, volume.. Where posts are being migrated, and how many posts have been migrated to each destination site.
### Response:
|
SELECT SUBSTRING(Comment, 11, STR_POSITION(Comment, '.') - 11) AS "destination_site", COUNT(*) AS "number_of_migrations" FROM PostHistory WHERE PostHistoryTypeId = 35 GROUP BY SUBSTRING(Comment, 11, STR_POSITION(Comment, '.') - 11) ORDER BY COUNT(*) DESC
|
### Instruction:
calculate the length of patient 13995's first stay in icu.
### 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 = 13995) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1
|
### Instruction:
What model has a g green rating, has chrysler jeep as a manufacturer, has an l/100km urban (cold) less than 18, and has an mpg-uk combined of 27.7?
### Response:
|
SELECT model FROM table_name_6 WHERE green_rating = "g" AND manufacturer = "chrysler jeep" AND l_100km_urban__cold_ < 18 AND mpg_uk_combined = 27.7
|
### Instruction:
how many patients have been prescribed with warfarin sodium 5 mg po tabs until 4 years ago?
### Response:
|
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'warfarin sodium 5 mg po tabs' AND DATETIME(medication.drugstarttime) <= DATETIME(CURRENT_TIME(), '-4 year'))
|
### 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 email and employee_id , and I want to sort in desc by the X.
### Response:
|
SELECT EMAIL, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY EMAIL DESC
|
### Instruction:
what was the name of the drugs that patient 95280 was first prescribed until 9 months ago?
### Response:
|
SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 95280) AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-9 month') ORDER BY prescriptions.startdate LIMIT 1
|
### Instruction:
calculate the number of patients that had a peritoneal fluid microbiology test since 5 years ago.
### 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 = 'peritoneal fluid' AND DATETIME(microbiologyevents.charttime) >= DATETIME(CURRENT_TIME(), '-5 year'))
|
### Instruction:
what is the number of patients who have been diagnosed with hypopotassemia and the 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 = "Hypopotassemia" AND prescriptions.drug_type = "MAIN"
|
### Instruction:
provide the number of patients whose diagnoses short title is polycythemia vera 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 = "Polycythemia vera" AND prescriptions.drug_type = "MAIN"
|
### Instruction:
what is the minimum hospital cost involving a drug that is called 0.9% sodium chloride (mini bag plus)?
### Response:
|
SELECT MIN(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT prescriptions.hadm_id FROM prescriptions WHERE prescriptions.drug = '0.9% sodium chloride (mini bag plus)') GROUP BY cost.hadm_id) AS t1
|
### Instruction:
when was patient 009-11235 prescribed for the first time a drug?
### Response:
|
SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-11235')) ORDER BY medication.drugstarttime LIMIT 1
|
### Instruction:
List prominent scholars in Theoretical ?
### Response:
|
SELECT DISTINCT COUNT(paper.paperid), writes.authorid FROM keyphrase, paper, paperkeyphrase, writes WHERE keyphrase.keyphrasename = 'Theoretical' 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:
how many patients whose diagnoses long title is neonatal hypoglycemia and lab test category is chemistry?
### 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 = "Neonatal hypoglycemia" AND lab."CATEGORY" = "Chemistry"
|
### Instruction:
Show a bar graph, the data is those times of trains that run through stations for the local authority Chiltern, and the Y axis is the total number of different times, display X from low to high order please.
### Response:
|
SELECT time, COUNT(time) FROM station AS t1 JOIN route AS t2 ON t1.id = t2.station_id JOIN train AS t3 ON t2.train_id = t3.id WHERE t1.local_authority = "Chiltern" GROUP BY time ORDER BY time
|
### Instruction:
count the number of patients who were admitted before the year 2157 and whose procedure long title is endoscopic sphincterotomy and papillotomy.
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2157" AND procedures.long_title = "Endoscopic sphincterotomy and papillotomy"
|
### Instruction:
provide the number of patients whose diagnoses short title is atrial fibrillation and lab test name is prostate specific antigen?
### 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 = "Atrial fibrillation" AND lab.label = "Prostate Specific Antigen"
|
### Instruction:
What is the district when the total amount of trees is smaller than 150817.6878461314 and amount of old trees is 1,928 (1.89%)?
### Response:
|
SELECT "District" FROM table_72091 WHERE "Total amount of trees" < '150817.6878461314' AND "Amount of old trees" = '1,928 (1.89%)'
|
### Instruction:
what are the five most frequently ordered medications during the previous year?
### Response:
|
SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions WHERE DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 <= 5
|
### Instruction:
What grades did I get in Prof. Seward 's courses ?
### Response:
|
SELECT DISTINCT student_record.grade FROM student_record INNER JOIN offering_instructor ON student_record.offering_id = offering_instructor.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id WHERE LOWER(instructor.name) LIKE '%Seward%' AND student_record.student_id = 1
|
### Instruction:
What is the total rank of the company with less than 248.44 billion in assets, an industry of oil and gas, headquarters in France, and a market value greater than 152.62 billions?
### Response:
|
SELECT COUNT(rank) FROM table_name_92 WHERE assets__billion_$_ < 248.44 AND industry = "oil and gas" AND headquarters = "france" AND market_value__billion_$_ > 152.62
|
### Instruction:
how many patients are diagnosed with venous insufficiency nos and treated with base drug type?
### 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 = "Venous insufficiency NOS" AND prescriptions.drug_type = "BASE"
|
### Instruction:
What are my grades for the courses taught by Prof. Aronoff ?
### Response:
|
SELECT DISTINCT student_record.grade FROM student_record INNER JOIN offering_instructor ON student_record.offering_id = offering_instructor.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id WHERE LOWER(instructor.name) LIKE '%Aronoff%' AND student_record.student_id = 1
|
### Instruction:
what are the four most commonly prescribed medications the previous year?
### Response:
|
SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions WHERE DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 <= 4
|
### Instruction:
how many patients whose diagnoses icd9 code is 57401 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.icd9_code = "57401" AND lab."CATEGORY" = "Blood Gas"
|
### Instruction:
count the number of patients whose ethnicity is hispanic/latino - puerto rican and procedure short title is cystoscopy nec?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND procedures.short_title = "Cystoscopy NEC"
|
### Instruction:
What Dental Report Write courses are there that meet the Core 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 '%Dental Report Write%' OR course.description LIKE '%Dental Report Write%' OR course.name LIKE '%Dental Report Write%') AND program_course.category LIKE '%Core%'
|
### Instruction:
Filter Questions by a Single Tag Name.
### Response:
|
SELECT P.Id AS "post_link" FROM Posts AS P, PostTags AS Pt, Tags AS T WHERE P.Id = Pt.PostId AND T.Id = Pt.TagId AND T.TagName = '##tags##' AND P.PostTypeId = 1 GROUP BY P.Id HAVING (SELECT COUNT(Pt.TagId) FROM PostTags AS Pt WHERE Pt.PostId = P.Id) = 1
|
### Instruction:
Provide the number of patients having lab test fluid as pleural that were diagnosed with adv eff benzodiaz tranq.
### 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 = "Adv eff benzodiaz tranq" AND lab.fluid = "Pleural"
|
### Instruction:
Dunbar's number and the social graph.
### Response:
|
SELECT COUNT(*) AS arity, A.OwnerUserId, Q.OwnerUserId FROM Posts AS A INNER JOIN Posts AS Q ON A.ParentId = Q.Id AND A.PostTypeId = 2 AND Q.PostTypeId = 1 AND Q.Score > 0 AND A.Score > 0 AND NOT A.OwnerUserId IS NULL AND NOT Q.OwnerUserId IS NULL GROUP BY A.OwnerUserId, Q.OwnerUserId
|
### Instruction:
keyphrases used by Akihito Kotera and Masatsugu Kidode
### Response:
|
SELECT DISTINCT paperkeyphrase.keyphraseid FROM author, paperkeyphrase, writes WHERE author.authorname IN ('Akihito Kotera', 'Masatsugu Kidode') AND writes.authorid = author.authorid AND writes.paperid = paperkeyphrase.paperid GROUP BY paperkeyphrase.keyphraseid HAVING COUNT(DISTINCT writes.authorid) = 2
|
### 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 email and commission_pct , display total number in asc order.
### Response:
|
SELECT EMAIL, COMMISSION_PCT FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY COMMISSION_PCT
|
### Instruction:
Find the name of the ships that are steered by both a captain with Midshipman rank and a captain with Lieutenant rank.
### Response:
|
SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id WHERE t2.rank = 'Midshipman' INTERSECT SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id WHERE t2.rank = 'Lieutenant'
|
### Instruction:
DUTCH 351 will be offered next semester , wo n't it ?
### Response:
|
SELECT COUNT(*) > 0 FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'DUTCH' AND course.number = 351 AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016
|
### Instruction:
tell me the name of the procedure that patient 027-154299 was last received?
### Response:
|
SELECT treatment.treatmentname FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-154299')) ORDER BY treatment.treatmenttime DESC LIMIT 1
|
### Instruction:
find the number of patients whose lab test category is chemistry and diagnoses icd9 code is 41519
### 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 = "41519" AND lab."CATEGORY" = "Chemistry"
|
### Instruction:
what is the number of patients whose diagnoses icd9 code is 99662 and drug route is 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.icd9_code = "99662" AND prescriptions.route = "NG"
|
### Instruction:
For all employees who have the letters D or S in their first name, find job_id and the sum of employee_id , and group by attribute job_id, and visualize them by a bar chart, display in descending by the sum employee id.
### 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:
the participant has a hemoglobin <= 12 g / dl ( <= 120 gm / l ) for male and <= 10 g / dl ( <= 100 gm / l ) for female at screening
### Response:
|
SELECT * FROM table_dev_27 WHERE (hemoglobin_a1c_hba1c <= 12 AND gender = 'male') OR (creatinine_clearance_cl <= 10 AND gender = 'female')
|
### Instruction:
what is the number of patients whose diagnoses icd9 code is 2930 and lab test category is chemistry?
### 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 = "2930" AND lab."CATEGORY" = "Chemistry"
|
### 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 department_id bin hire_date by time.
### 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:
what is the number of patients whose diagnoses icd9 code is 2749 and lab test category is chemistry?
### 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 = "2749" AND lab."CATEGORY" = "Chemistry"
|
### 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:
count the number of patients whose diagnoses short title is ocl crtd art wo infrct and lab test abnormal status is delta?
### 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 = "delta"
|
### 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 do not work in departments with managers that have ids between 100 and 200, give me the comparison about department_id over the job_id by a bar chart, rank bars in desc order.
### Response:
|
SELECT JOB_ID, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY JOB_ID DESC
|
### 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"
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.