instruction stringlengths 57 490 | output stringlengths 69 1.29k |
|---|---|
### Instruction:
Good and Bad code examples.
### Response:
| SELECT COUNT(*) FROM Posts WHERE Body LIKE '%<code>%' AND ParentId IN (1109022, 151777, 541966, 1016896, 6343166, 477572, 2591036, 3145089, 2201917, 5033012, 600207, 3035692, 1560788, 2091465, 531427, 2139134, 6495898, 3166501, 4605527, 2736389, 2150078, 6200533, 867518, 2471935, 3624280, 2459916, 1667278, 2795833, 231... |
### Instruction:
How many times a week does AERO 202 meet ?
### Response:
| SELECT (SELECT SUM(CASE WHEN DERIVED_TABLEalias0.FRIDAY = 'Y' THEN 1 ELSE 0 END) + SUM(CASE WHEN DERIVED_TABLEalias0.MONDAY = 'Y' THEN 1 ELSE 0 END) + SUM(CASE WHEN DERIVED_TABLEalias0.SATURDAY = 'Y' THEN 1 ELSE 0 END) + SUM(CASE WHEN DERIVED_TABLEalias0.SUNDAY = 'Y' THEN 1 ELSE 0 END) + SUM(CASE WHEN DERIVED_TABLEalia... |
### Instruction:
what is the cheapest one way flight from ATLANTA to BOSTON
### Response:
| SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ATLANTA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city... |
### Instruction:
first flights from PITTSBURGH to ATLANTA on a THURSDAY
### Response:
| SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND days.day_name = 'THURSDAY' AND flight.flight_days = days.days_code AN... |
### Instruction:
i need to fly from KANSAS CITY to CHICAGO leaving next wednesday and returning the following day
### Response:
| SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'CHICAGO' AND date_day.day_number = 23 AND date_day.month_number = 4 AND ... |
### Instruction:
how many patients were diagnosed with end stage renal disease and they didn't come back to the hospital within 2 months until 2 years ago?
### Response:
| SELECT (SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'end stage ... |
### Instruction:
since 1 year ago, for male patients aged 30s, what are the three most frequent drugs prescribed within 2 months after they have been diagnosed with pneumonia, organism nos?
### Response:
| SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE ... |
### Instruction:
what are the four most frequent drugs prescribed to male patients of the 50s within the same month after they have been diagnosed until 1 year ago with esophageal reflux?
### Response:
| SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE ... |
### Instruction:
what is the drug which was prescribed to patient 58649 within 2 days after undergoing lt heart angiocardiogram in 08/last year?
### Response:
| SELECT t2.drug FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE admissions.subject_id = 58649 AND procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = ... |
### Instruction:
what was the two year survival rate of retropharyngeal abscess patients who were prescribed with dobutamine?
### Response:
| SELECT SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t4.charttime) > 2 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.subject_id, t2.charttime FROM (SELECT t1.subject_id, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd... |
### Instruction:
what is the latest flight i can take from WASHINGTON to SAN FRANCISCO
### Response:
| SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'WASHINGTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SA... |
### Instruction:
how many patients have received rt heart cardiac cath during a year before within 2 months after the diagnosis of abn react-external stoma?
### Response:
| SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'abn react-external... |
### Instruction:
what were the three most frequent drugs that were prescribed to the patients 60 or above during the same month after they had been diagnosed with staphylococcus unspcfied in this year?
### Response:
| SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE ... |
### Instruction:
flights from MILWAUKEE to PHOENIX on saturday or sunday AA
### Response:
| SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day AS DATE_DAY_0, date_day AS DATE_DAY_1, days AS DAYS_0, days AS DAYS_1, flight WHERE (((flight.airline_code = 'AA') AND ((flight.flight_days = DAYS_0.days_code AND DA... |
### Instruction:
what were the five most frequent drugs prescribed during the same hospital encounter to the patients aged 50s after they had been diagnosed with hyposmolality, in this year?
### Response:
| SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_... |
### Instruction:
i would like to find flights from COLUMBUS to MINNEAPOLIS on monday june fourteenth early in the morning or in the evening sunday 6 13 thank you
### Response:
| SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((((flight.departure_time BETWEEN 0 AND 800) AND date_day.day_number = 13 AND date_day.month_number = 6 AND date_day.year = 1991 AND days.day_nam... |
### Instruction:
until 1 year ago, for patients of the 60 or above, what was the three most frequently prescribed drugs within 2 months after they had been diagnosed with dvrtclo colon w/o hmrhg?
### Response:
| SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE ... |
### Instruction:
what was the top four most frequent microbiology tests ordered for patients within 2 months after receiving a fus/refus 2-3 vertebrae until 4 years ago?
### Response:
| SELECT t3.spec_type_desc FROM (SELECT t2.spec_type_desc, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FR... |
### Instruction:
count the number of patients who received arterial catheterization within 2 months after a diagnosis of malfunc cardiac pacemake since 3 years ago.
### Response:
| SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'malfunc cardiac pa... |
### Instruction:
is patient 31615's arterial bp [diastolic] second measured on the last intensive care unit visit greater than the first value measured on the last intensive care unit visit?
### Response:
| SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 31615) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime DESC LIMIT 1) AND chartevents... |
### Instruction:
how many patients received inj/inf platelet inhibit during the same hospital visit following the diagnosis of subclavian steal syndrom since 3 years ago?
### Response:
| SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title =... |
### Instruction:
what were the three most common lab tests that patients were given in the same hospital encounter after being diagnosed with dmii circ nt st uncntrld in 2101?
### Response:
| SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t3.itemid FROM (SELECT t2.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id W... |
### Instruction:
i would like a flight that leaves on friday from PHILADELPHIA to DALLAS that makes a stop in ATLANTA
### Response:
| SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, date_day, days, flight, flight_stop WHERE ((CITY_2.city_code = AIRPORT_SERVICE_2.city_code AND CITY_2.city_name = 'ATLAN... |
### Instruction:
what was the name of the prescription drug patient 012-85821 was prescribed during the same day after having received a vte prophylaxis - coumadin procedure in 04/2102?
### Response:
| SELECT t2.drugname FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-85821') AND treatment.treatme... |
### Instruction:
please list all of the flights leaving ATLANTA heading to BALTIMORE after 2000 wednesday and before 900 thursday
### Response:
| SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((date_day.day_number = 24 AND date_day.month_number = 4 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.departure_time... |
### Instruction:
what are the three most commonly prescribed medications for patients who have received audiological evaluation before during the same month, during this year?
### Response:
| SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures ... |
### Instruction:
how much does the arterial bp [systolic] of patient 8116 vary second measured on the current intensive care unit visit compared to the first value measured on the current intensive care unit visit?
### Response:
| SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 8116) AND icustays.outtime IS NULL) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_it... |
### Instruction:
what is the change in weight of patient 21454 second measured on the first hospital visit compared to the value first measured on the first hospital visit.
### Response:
| SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 21454 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1)) AND chartev... |
### Instruction:
what are the top four most common medications that followed within 2 months for patients who were diagnosed with atriovent block complete since 2103?
### Response:
| SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE ... |
### Instruction:
what's the top four diagnosis that had the highest two year mortality rate?
### Response:
| SELECT t4.diagnosisname FROM (SELECT t3.diagnosisname, DENSE_RANK() OVER (ORDER BY t3.c1 DESC) AS c2 FROM (SELECT t2.diagnosisname, 100 - SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t2.diagnosistime) > 2 * 365 THEN 1 ELSE 0 END) * 10... |
### Instruction:
what drug was prescribed to patient 65582 within 2 days after having undergone the pancreat sphincteroplas since 02/2105?
### Response:
| SELECT t2.drug FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE admissions.subject_id = 65582 AND procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = ... |
### Instruction:
Votes cast vs post year.
### Response:
| WITH posts_agg AS (SELECT YEAR(CreationDate) AS y, COUNT(*) AS c FROM Posts WHERE PostTypeId IN (1, 2) AND OwnerUserId = 635608 GROUP BY YEAR(CreationDate)) SELECT Post_year AS "Post year", Posts_that_year AS "Posts that year", '2008', '2009', '2010', '2011', '2012', '2013', '2014' FROM (SELECT YEAR(v.CreationDate) AS ... |
### Instruction:
list the top three most common drugs that patients are prescribed with during the same month after being diagnosed with hypocalcemia - due to rhabdomyolysis until 2 years ago.
### Response:
| SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'hypocalcemia - due to rhabdomyolysis' AND DATETIME... |
### Instruction:
is patient 10855's temperature c (calc) last measured on the current icu visit less than first measured on the current icu visit?
### Response:
| SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 10855) AND icustays.outtime IS NULL) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_i... |
### Instruction:
what are the four most commonly prescribed medications for patients, which were also previously prescribed to patients with 1000 ml flex cont: lactated ringers iv soln during the same month until 2104?
### Response:
| SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = '1000 ml flex cont: lactated ringers iv soln' AND ST... |
### Instruction:
what were the three most commonly performed procedures for patients who had received special care bed previously within 2 months, in a year before?
### Response:
| SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'special care bed' AND DATETIME(treatment... |
### Instruction:
count the number of patients who had been diagnosed with hyp kid nos w cr kid v in the same month after they had been diagnosed with crnry athrscl natve vssl.
### Response:
| SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'hyp kid nos w cr k... |
### Instruction:
since 2 years ago, what were the top three most frequently ordered lab tests for patients during the same hospital encounter after the diagnosis of intra-abdominal abscess - intestinal?
### Response:
| SELECT t3.labname FROM (SELECT t2.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'intra-abdominal a... |
### Instruction:
what are the four most common diagnostics for people who were diagnosed with metabolic alkalosis earlier within the same hospital visit, until 2104?
### Response:
| SELECT t3.diagnosisname FROM (SELECT t2.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'metab... |
### Instruction:
list the five most frequent diagnoses that patients have been diagnosed with in the same hospital encounter after undergoing electrolyte administration since 6 years ago.
### Response:
| SELECT t3.diagnosisname FROM (SELECT t2.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'elect... |
### Instruction:
how many patients were prescribed with ns within the same month last year after the diagnosis with assault nos?
### Response:
| SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'assault nos') AND ... |
### Instruction:
what is the top five most common procedures that followed within the same hospital visit for patients who received fiberoptic colonoscopy - with chemocautery since 2102?
### Response:
| SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'fiber... |
### Instruction:
what is the four most frequent procedures that patients have received within 2 months following a anticoagulant administration - factor xa inhibitor procedure until 2102?
### Response:
| SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'anticoagulant administration - factor xa... |
### Instruction:
Decadist badge: Collected at least 200 rep from post votes in each year of the last 10. Not exact, we can't count a lot of things affecting the reputation, but it is about roughly this. Check this [meta discussion](https://meta.stackoverflow.com/q/374646/1783163).
### Response:
| WITH VoteRep AS (SELECT 1 AS VoteTypeId, 2 AS PostTypeId, 15 AS Rep UNION SELECT 2 AS VoteTypeId, 1 AS PostTypeId, 5 AS Rep UNION SELECT 2 AS VoteTypeId, 2 AS PostTypeId, 10 AS Rep UNION SELECT 3 AS VoteTypeId, 1 AS PostTypeId, -2 AS Rep UNION SELECT 3 AS VoteTypeId, 2 AS PostTypeId, -2 AS Rep), Raw AS (SELECT VoteRep.... |
### Instruction:
since 1 year ago, what were the top four most frequent laboratory tests ordered for patients within 2 months after receiving a glucocorticoid administration - oral?
### Response:
| SELECT t3.labname FROM (SELECT t2.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'glucocorticoid administration - oral' AND DATETIME(t... |
### Instruction:
what are the three most commonly ordered procedures for patients who had been previously diagnosed with suicidal ideation within the same month until 3 years ago?
### Response:
| SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'suicidal ideation' AND DATETIME(diagnosi... |
### Instruction:
how many patients received a blepharorrhaphy after the first serum transfusion nec within 2 months?
### Response:
| SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'serum trans... |
### Instruction:
Does the Spring-Summer curriculum allow me to take MFG 582 ?
### Response:
| SELECT COUNT(*) > 0 FROM (SELECT course_id FROM student_record WHERE earn_credit = 'Y' AND student_id = 1) AS DERIVED_TABLEalias0, course AS COURSEalias0, course_offering AS COURSE_OFFERINGalias0, semester AS SEMESTERalias0 WHERE COURSEalias0.course_id = COURSE_OFFERINGalias0.course_id AND NOT COURSEalias0.course_id IN... |
### Instruction:
list WEDNESDAY night flights from OAKLAND to SALT LAKE CITY
### Response:
| SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, days, flight WHERE ((((flight.departure_time <= 2359 AND flight.departure_time >= 1800) AND days.day_name = 'WEDNESDAY' AND flight.flight_days = days.days_code) OR ((flight.d... |
### Instruction:
among patients who have been diagnosed with preterm nec 2500+g tell me the two year survival rate.
### Response:
| SELECT SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t2.charttime) > 2 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t1.subject_id, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id... |
### Instruction:
list the top three most common medications that patients were prescribed with within 2 months after being prescribed megestrol acetate until 2104.
### Response:
| SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'megestrol acetate' AND STRFTIME('%y', prescriptions.startdate) <=... |
### Instruction:
what flights go from DENVER to ST. LOUIS on tuesday morning
### Response:
| SELECT DISTINCT flight_id FROM flight WHERE (((flight_days IN (SELECT DAYSalias0.days_code FROM days AS DAYSalias0 WHERE DAYSalias0.day_name IN (SELECT DATE_DAYalias0.day_name FROM date_day AS DATE_DAYalias0 WHERE DATE_DAYalias0.day_number = 22 AND DATE_DAYalias0.month_number = 3 AND DATE_DAYalias0.year = 1991)) AND to... |
### Instruction:
i want to go from BALTIMORE to SAN FRANCISCO with a stopover in DENVER
### Response:
| SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND CIT... |
### Instruction:
for patients that were prescribed with lithium carbonate sr (lithobid), what are the four most commonly ordered drugs at the same time, until 1 year ago?
### Response:
| SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'lithium carbonate sr (lithobid)' AND DATETIME(prescriptions.start... |
### Instruction:
Rep loss if identification-request questions were to be deleted. Excludes rep changes resulting from suggested edits to identification-request questions.
### Response:
| SELECT u.Id AS "user_link", (CASE WHEN p.PostTypeId = 1 AND v.VoteTypeId = 2 THEN 5 WHEN p.PostTypeId = 2 AND v.VoteTypeId = 2 THEN 10 WHEN p.PostTypeId = 1 AND v.VoteTypeId = 3 THEN -1 WHEN p.PostTypeId = 2 AND v.VoteTypeId = 3 THEN -2 WHEN p.PostTypeId = 2 AND v.VoteTypeId = 1 THEN 15 END) AS "totalscore", p.PostType... |
### Instruction:
Where did I meet this user. Questions at which the two users met
One of the following cases happenned:
- one posted question, the other one answer
- both posted two concurrent answers
- one commented one the other one's post
- both commented on the same post
So we don't involve cases when e.g... | SELECT Q.Title, T.Id FROM (SELECT * FROM (SELECT (CASE WHEN PostTypeId = 2 THEN ParentId ELSE P.Id END) AS Id FROM Posts AS P JOIN Comments AS C1 ON C1.PostId = P.Id LEFT JOIN Comments AS C2 ON C2.PostId = P.Id WHERE (P.PostTypeId = 1 OR P.PostTypeId = 2) AND ((P.OwnerUserId = '##UserId##' AND C1.UserId = '##OtherUser#... |
### Instruction:
how much is the difference in magnesium for patient 003-50177 second measured on the last hospital visit compared to the value first measured on the last hospital visit?
### Response:
| SELECT (SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '003-50177' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospi... |
### Instruction:
How many courses are taught by more than 2 professors ?
### Response:
| SELECT COUNT(DISTINCT course_offering.course_id) FROM course, course_offering, offering_instructor AS OFFERING_INSTRUCTOR_0, offering_instructor AS OFFERING_INSTRUCTOR_1, offering_instructor AS OFFERING_INSTRUCTOR_2 WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND OFFERING_INSTRUCTO... |
### Instruction:
what was the top four most frequent specimen tests given to patients within the same month after diagnosis of valvular insufficiency - aortic valve?
### Response:
| SELECT t3.culturesite FROM (SELECT t2.culturesite, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'valvular insufficiency - aortic valve') AS t... |
### Instruction:
patient must agree to use adequate contraception defined as: for female , one of the following ( 1 ) surgical sterilization, ( 2 ) approved hormonal contraceptives ( such as birth control pills, depo _ provera, or lupron depot ) , ( 3 ) barrier methods ( such as a condom or diaphragm ) used with a sper... | SELECT * FROM table_test_31 WHERE adequate_contraception = 1 OR (gender = 'female' AND ((surgical_sterilization = 1 OR hormonal_contraceptives = 1 OR birth_control_pills = 1 OR depo_provera = 1 OR lupron_depot = 1) OR (barrier_methods = 1 AND spermicide = 1) OR intrauterine_device = 1 OR iud = 1)) OR (gender = 'male' A... |
### Instruction:
New Questions View Analysis by Tags.
### Response:
| SELECT YEAR(CreationDate) AS "year", MONTH(CreationDate) AS "month", t.TagName, AVG(AnswerCount) AS AverageAnswersPerQuestion, SUM(ViewCount) / COUNT(p.Id) AS AverageNewQuestionViews, COUNT(p.Id) AS NewQuestionCount, SUM(ViewCount) AS NewQViewCount FROM Posts AS p JOIN PostTypes AS pt ON p.PostTypeId = pt.Id JOIN PostT... |
### Instruction:
count the number of patients who were diagnosed with dka during the same hospital encounter since 2100 after receiving a antidepressant - vanafaxine (effexor) procedure.
### Response:
| SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'antidepressant - vanafaxine (effexor)' AND STRFTIME('%y', treatment.treat... |
### Instruction:
among the patients who were diagnosed with bone fracture(s) - right lower extremity tell me the three year survival rate.
### Response:
| SELECT SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t2.diagnosistime) > 3 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOI... |
### Instruction:
How to calculate statistics on stackoverflow?. http://meta.stackoverflow.com/questions/297236/how-to-calculate-statistics-on-stackoverflow/313188#313188
### Response:
| SELECT YEAR(v.CreationDate), COUNT(*) AS total, SUM(CASE WHEN v.VoteTypeId = 2 THEN 1 ELSE 0 END) AS upvotes, SUM(CASE WHEN v.VoteTypeId = 3 THEN 1 ELSE 0 END) AS downvotes, SUM(CASE WHEN v.VoteTypeId = 2 AND t.TagName = 'c#' THEN 1 ELSE 0 END) AS "c#_up_votes", SUM(CASE WHEN v.VoteTypeId = 3 AND t.TagName = 'c#' THEN ... |
### Instruction:
show flights leaving BOSTON on wednesday morning and arriving in DENVER
### Response:
| SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' AND date_day.day_number = 23 AND date_day.month_number = 4 AND d... |
### Instruction:
is the value of patient 016-9636's last sao2 measured on the current icu visit greater than the second to last value measured on the current icu visit?
### Response:
| SELECT (SELECT vitalperiodic.sao2 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-9636') AND patient.unitdischargetime IS NULL) AND ... |
### Instruction:
how many flights are there between SAN FRANCISCO and PHILADELPHIA on 8 18
### Response:
| SELECT COUNT(DISTINCT flight.flight_id) FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILADELPHIA' AND date_day.day_number = 18 AND date_day.month_numb... |
### Instruction:
are the values of bilirubin, total of patient 13841 second measured on the last hospital visit greater than those first measured on the last hospital visit?
### Response:
| SELECT (SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 13841 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.l... |
### Instruction:
how many patients have received nitroglycerin since 6 years ago within the same hospital visit after receiving anticonvulsant - gabapentin?
### Response:
| SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'anticonvulsant - gabapentin' AND DATETIME(treatment.treatmenttime) >= DAT... |
### Instruction:
what flights go from CHICAGO to SEATTLE on CO on saturday
### Response:
| SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SEATTLE' AND date_day.day_number = 26 AND date_day.month_number = 7 AND ... |
### Instruction:
compared to last measured on the last hospital visit patient 75170's potassium is greater than the value second to last measured on the last hospital visit?
### Response:
| SELECT (SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 75170 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.l... |
### Instruction:
provide a list of the five most frequent procedures that patients took during the same hospital visit following their administration of electrolytes - phosphate treatment.
### Response:
| SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'admin... |
### Instruction:
is the heartrate value of patient 030-44598 second measured on the current icu visit less than first measured on the current icu visit?
### Response:
| SELECT (SELECT vitalperiodic.heartrate FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-44598') AND patient.unitdischargetime IS NULL... |
### Instruction:
all right what do you have from OAKLAND to PHILADELPHIA on wednesday
### Response:
| SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILADELPHIA' AND date_day.day_number = 23 AND date_day.month_number = 4 ... |
### Instruction:
since 2105, how many patients were prescribed with propofol within 2 months after having been diagnosed with pneumonia?
### Response:
| SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'pneumonia' AND STRFTIME('%y', diagnosis.diagnosistime) >= '2105') AS t1 JOIN (SELECT patient.uniquepid, medi... |
### Instruction:
Answers that took way too long to accept (single user). Answers that took the longest from being posted to being accepted. Only answers that are currently accepted are counted. This query is for a single user; for all users, see query 695493.
### Response:
| SELECT Posts.Id AS "post_link", DATEDIFF(day, Posts.CreationDate, CreationDate) AS "time_taken_to_accept_in_days", ROUND(DATEDIFF(day, Posts.CreationDate, CreationDate) / 12.0, 0) AS "in_months", ROUND(DATEDIFF(day, Posts.CreationDate, CreationDate) / 365.0, 1) AS "and_in_years" FROM Posts JOIN Votes ON Posts.Id = Vote... |
### Instruction:
Answered/Unanswered Questions for a Tag by Month.
### Response:
| SELECT T.Month, (T.QuestionCount - T.UnansweredCount) / CAST(T.QuestionCount AS FLOAT) AS AnswerRate FROM (SELECT CAST(CAST(TIME_TO_STR(CreationDate, '%YEAR') AS TEXT) + '-' + CAST(TIME_TO_STR(CreationDate, '%-mONT%-H') AS TEXT) + '-01' AS DATETIME) AS "Month", SUM(CAST(CASE WHEN AnswerCount = 0 THEN 1 ELSE 0 END AS IN... |
### Instruction:
what is the difference in creatine kinase (ck) in patient 1114's body last measured on the current hospital visit compared to the second to last value measured on the current hospital visit?
### Response:
| SELECT (SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1114 AND admissions.dischtime IS NULL) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'creatine kinase (ck)') ORDER BY labevent... |
### Instruction:
are patient 369's red blood cells levels less second measured on the last hospital visit than the levels first measured on the last hospital visit?
### Response:
| SELECT (SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 369 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.lab... |
### Instruction:
what flights from LAS VEGAS to MONTREAL on saturday
### Response:
| SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MONTREAL' AND date_day.day_number = 26 AND date_day.month_number = 7 AND ... |
### Instruction:
is the value of the hematocrit, calculated of patient 2518 last measured on the current hospital visit greater than second to last measured on the current hospital visit?
### Response:
| SELECT (SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 2518 AND admissions.dischtime IS NULL) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'hematocrit, calculated') ORDER BY labeve... |
### Instruction:
is the arterial bp [systolic] of patient 18517 normal in 06/last year?
### Response:
| SELECT COUNT(*) > 0 FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 18517)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp [syst... |
### Instruction:
For classes with labs , who are the professors not teaching them ?
### Response:
| SELECT DISTINCT instructor.name FROM instructor, course, course_offering, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course_offering.offering_id = offering_instructor.offering_id AND instructor.instructor_id = offering_instructor.instructor_id AND NOT instr... |
### Instruction:
2 or more systemic inflammatory response syndrome ( sirs ) criteria: white blood cell count less than 4000 per mm3, greater than 12000 per mm3, or differential with greater than 10 % immature forms; heart rate greater than 90 beats per minute; respiratory rate greater than 20 breaths per minute or paco... | SELECT * FROM table_train_8 WHERE (CASE WHEN white_blood_cell_count_wbc < 4000 OR white_blood_cell_count_wbc > 12000 OR immature_form > 10 THEN 1 ELSE 0 END + CASE WHEN heart_rate > 90 THEN 1 ELSE 0 END + CASE WHEN respiratory_rate > 20 OR paco2 < 32 THEN 1 ELSE 0 END + CASE WHEN temperature > 38 OR temperature < 36 TH... |
### Instruction:
what is the earliest flight between BOS and BWI
### Response:
| SELECT DISTINCT flight.flight_id FROM airport AS AIRPORT_0, airport AS AIRPORT_1, flight WHERE (AIRPORT_0.airport_code = 'BOS' AND AIRPORT_1.airport_code = 'BWI' AND flight.from_airport = AIRPORT_0.airport_code AND flight.to_airport = AIRPORT_1.airport_code) AND flight.departure_time = (SELECT MIN(FLIGHTalias1.departur... |
### Instruction:
For the least difficult Core classes , which one has the most students ?
### Response:
| SELECT DISTINCT department, name, number FROM course WHERE course_id IN (SELECT PROGRAM_COURSE_ID FROM program_course AS PROGRAM_COURSE WHERE PROGRAM_WORKLOAD = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 WHERE PROGRAM_COURSEalias1.category LIKE '%Core%')) AND num_enrolled = (... |
### Instruction:
Most popular StackOverflow tags in date range.
### Response:
| SELECT num.TagName AS Tag, ROW_NUMBER() OVER (ORDER BY rate.Rate DESC) AS MayRank, ROW_NUMBER() OVER (ORDER BY num.Num DESC) AS TotalRank, rate.Rate AS QuestionsInMay, num.Num AS QuestionsTotal FROM (SELECT COUNT(PostId) AS Rate, TagName FROM Tags, PostTags, Posts WHERE Tags.Id = PostTags.TagId AND Posts.Id = PostId AN... |
### Instruction:
what kind of airline is flight UA 281 from BOSTON to DENVER
### Response:
| SELECT DISTINCT airline.airline_code FROM airline, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE ((CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_... |
### Instruction:
JavaScript MVC Framework Trends (from TodoMVC) (# of Questions per Month).
### Response:
| SELECT DATEADD(mm, (YEAR(2017) - 1900) * 12 + MONTH(Posts.CreationDate) - 1, 0) AS Month, Tags.TagName, COUNT(*) AS Questions FROM Tags LEFT JOIN PostTags ON PostTags.TagId = Tags.Id LEFT JOIN Posts ON Posts.Id = PostTags.PostId LEFT JOIN PostTypes ON PostTypes.Id = Posts.PostTypeId WHERE Tags.TagName IN ('backbone.js'... |
### Instruction:
Find number of answers per month since 2012 for Trusted Users.
### Response:
| SELECT u.Id, u.Reputation, u.DisplayName, TIME_TO_STR(p.CreationDate, '%YEAR') AS Year, TIME_TO_STR(p.CreationDate, '%-mONT%-H') AS Month, COUNT(*) AS Count FROM Users AS u INNER JOIN Posts AS p ON u.Id = p.OwnerUserId WHERE TIME_TO_STR(p.CreationDate, '%Year') >= 2012 AND TIME_TO_STR(p.CreationDate, '%Year') < 2013 AN... |
### Instruction:
how many patients were diagnosed with headache - hydrocephalus within 2 months after having received a vte prophylaxis - compression stockings?
### Response:
| SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'vte prophylaxis - compression stockings') AS t1 JOIN (SELECT patient.uniquepid, diagnosis.diagnosistime FROM... |
### Instruction:
oh let 's see does EA have a flight from ATLANTA to WASHINGTON
### Response:
| SELECT DISTINCT airline.airline_code FROM airline, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE ((flight.airline_code = 'EA') AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WASHINGTON' AND flight.to_airport = AIRPORT... |
### Instruction:
now show me the flights from DENVER to PHILADELPHIA on a SATURDAY
### Response:
| SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILADELPHIA' AND days.day_name = 'SATURDAY' AND flight.flight_days = days.days_cod... |
### Instruction:
Suspended users of the site, ordered by estimated reputation, with hidden accounts.
### Response:
| SELECT Users.Id AS "user_link", COUNT(*) * 10 AS "estimated_rep", 'https://stackexchange.com/users/' + CAST(MIN(Users.AccountId) AS TEXT) + '|' + MIN(Users.DisplayName) AS "network_profile", 'https://data.stackexchange.com/meta.stackexchange/query/1089480?' + 'NetworkAccountId=' + CAST(MIN(Users.AccountId) AS TEXT) + '... |
### Instruction:
when was the last time patient 15447 measured its respiratory rate greater than 13.0 since 07/13/2102?
### Response:
| SELECT chartevents.charttime FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 15447)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'respirat... |
### Instruction:
show flights leaving MIAMI to CLEVELAND on US that leave after 1200
### Response:
| SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'CLEVELAND' AND flight.departure_time > 1200 AND flight.to_airport = AIRPORT_SERVICE_1.ai... |
### Instruction:
What time is Geoffrey Bankowski next teaching 463 ?
### Response:
| SELECT DISTINCT semester.semester, semester.year FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.number = 463 AND course_offering.semester = semester.semester_id AND instructor.name LIKE '%Geoffrey Bankowski%' AND offering_instructor.... |
### Instruction:
Reputation Gained until a Certain Date.
### Response:
| SELECT SUM((CASE WHEN (p.PostTypeId = 1 AND v.VoteTypeId = 2 AND (p.CommunityOwnedDate > v.CreationDate OR p.CommunityOwnedDate IS NULL)) THEN 5 WHEN (p.PostTypeId = 2 AND v.VoteTypeId = 2 AND (p.CommunityOwnedDate > v.CreationDate OR p.CommunityOwnedDate IS NULL)) THEN 10 WHEN (v.VoteTypeId = 3 AND (p.CommunityOwnedDa... |
### Instruction:
show me flights from BALTIMORE to PHILADELPHIA arriving after 2100
### Response:
| SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILADELPHIA' AND flight.arrival_time > 2100 AND flight.to_airport = AIRPORT_SERVICE_1.ai... |
### Instruction:
what are the four most common diagnosis of patients with age 40s during a year before?
### Response:
| SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.