instruction
stringlengths 37
754
| output
stringlengths 9
3.43k
|
---|---|
### Instruction:
did patient 025-32034 have a sao2 that was greater than 100.0 on this month/07?
### Response:
|
SELECT COUNT(*) > 0 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-32034')) AND vitalperiodic.sao2 > 100.0 AND NOT vitalperiodic.sao2 IS NULL AND DATETIME(vitalperiodic.observationtime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') AND STRFTIME('%d', vitalperiodic.observationtime) = '07'
|
### Instruction:
My List of Tag Synonyms which permit Voting.
### Response:
|
SELECT 'site://tags/' + TargetTagName + '/synonyms|' + TargetTagName AS "vote4me", COUNT(SourceTagName) AS "synonyms" FROM TagSynonyms AS TS WHERE ApprovalDate IS NULL AND (SELECT SUM(CASE V.VoteTypeId WHEN 2 THEN 1 WHEN 3 THEN -1 END) FROM Tags AS T, PostTags AS Pt, Posts AS P, Votes AS V, VoteTypes AS Vt WHERE T.Id = Pt.TagId AND P.Id = V.PostId AND Pt.PostId = P.ParentId AND Vt.Id = V.VoteTypeId AND T.TagName = TargetTagName AND P.OwnerUserId = '##userid##' AND P.CommunityOwnedDate IS NULL) > 4 GROUP BY TargetTagName
|
### Instruction:
this month was the heart rate of patient 10855 ever greater than 95.0?
### 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 = 10855)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'heart rate' AND d_items.linksto = 'chartevents') AND chartevents.valuenum > 95.0 AND DATETIME(chartevents.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month')
|
### Instruction:
what is the daily average amount of total bilirubin patient 006-200601 has in 09/last year?
### Response:
|
SELECT AVG(lab.labresult) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-200601')) AND lab.labname = 'total bilirubin' AND DATETIME(lab.labresulttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', lab.labresulttime) = '09' GROUP BY STRFTIME('%y-%m-%d', lab.labresulttime)
|
### Instruction:
how about flights leaving SAN FRANCISCO and arriving in BOSTON for any 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, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SAN FRANCISCO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
|
### Instruction:
What classes are essential before I can start AAS 381 ?
### Response:
|
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND NOT COURSE_0.course_id IN (SELECT STUDENT_RECORDalias0.course_id FROM student_record AS STUDENT_RECORDalias0 WHERE STUDENT_RECORDalias0.student_id = 1) AND COURSE_1.course_id = course_prerequisite.course_id AND COURSE_1.department = 'AAS' AND COURSE_1.number = 381
|
### Instruction:
what is the daily maximum amount of indwelling catheter in patient 005-18714 until 11/2105?
### Response:
|
SELECT MAX(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-18714')) AND intakeoutput.celllabel = 'indwelling catheter' AND intakeoutput.cellpath LIKE '%output%' AND STRFTIME('%y-%m', intakeoutput.intakeoutputtime) <= '2105-11' GROUP BY STRFTIME('%y-%m-%d', intakeoutput.intakeoutputtime)
|
### Instruction:
Days to Close a Duplicate Question by Creation Month.
### Response:
|
SELECT date1 AS creationDate, AVG(diff1) AS avgDaysToClose FROM (SELECT DATEDIFF(day, d.CreationDate, ClosedDate) AS "diff1", FORMAT(d.CreationDate, 'yy-MM') AS "date1", FORMAT(d.ClosedDate, 'yy-MM') AS "date2", (d.Id) AS id FROM Posts AS d LEFT JOIN PostHistory AS ph ON ph.PostId = d.Id LEFT JOIN PostLinks AS pl ON pl.PostId = d.Id LEFT JOIN Posts AS o ON o.Id = pl.RelatedPostId WHERE d.PostTypeId = 1 AND pl.LinkTypeId = 3 AND ph.PostHistoryTypeId = 10) AS t1 GROUP BY date1 ORDER BY date1
|
### Instruction:
how many hours have passed since last time patient 23436 was diagnosed with senile dementia uncomp during this hospital visit?
### Response:
|
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', diagnoses_icd.charttime)) FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'senile dementia uncomp') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 23436 AND admissions.dischtime IS NULL) ORDER BY diagnoses_icd.charttime DESC LIMIT 1
|
### Instruction:
Average score for questions and answers, by tag. For all canonical tags, what is the average question score and the average answer score?
### Response:
|
SELECT 'site://questions/tagged/' + CAST(Tags.TagName AS TEXT) + '|' + CAST(Tags.TagName AS TEXT) AS "tag", AVG(Answers.Score) AS "average_score", STDEV(Answers.Score) AS "score_stddev", COUNT(Answers.Id) AS "#_answers" FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts AS Questions ON Questions.Id = PostTags.PostId INNER JOIN Posts AS Answers ON Answers.ParentId = Questions.Id WHERE Answers.PostTypeId = 2 GROUP BY Tags.Id, Tags.TagName ORDER BY 2 DESC, 3, 1
|
### Instruction:
Finding Front End developers in Kochi and Trivandram.
### Response:
|
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", u.Id AS "user_link", u.Reputation, COUNT(p.Id) FROM Users AS u INNER JOIN Posts AS p ON p.OwnerUserId = u.Id INNER JOIN PostTags AS pt ON pt.PostId = p.Id INNER JOIN Tags AS t ON t.Id = pt.TagId WHERE (LOWER(Location) LIKE LOWER('%kochi%') OR LOWER(Location) LIKE LOWER('%trivandram%')) AND (t.TagName = 'html' OR t.TagName = 'css' OR t.TagName = 'css3' OR t.TagName = 'html5' OR t.TagName = 'bootstrap') GROUP BY u.Reputation, u.Id ORDER BY Reputation DESC
|
### Instruction:
when did patient 013-17922 receive a prescription for insulin aspart in 05/last year first?
### 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 = '013-17922')) AND medication.drugname = 'insulin aspart' AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', medication.drugstarttime) = '05' ORDER BY medication.drugstarttime LIMIT 1
|
### Instruction:
what were the total amount of d20w intake that patient 30171 had received on 05/30/2101?
### Response:
|
SELECT SUM(inputevents_cv.amount) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 30171)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'd20w' AND d_items.linksto = 'inputevents_cv') AND STRFTIME('%y-%m-%d', inputevents_cv.charttime) = '2101-05-30'
|
### Instruction:
what are the numbers of patients who have had a influenza vaccination two times during a year before?
### Response:
|
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, COUNT(*) AS c1 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 = 'influenza vaccination') AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY admissions.subject_id) AS t1 WHERE t1.c1 = 2
|
### Instruction:
Search for obsolete 'please accept' comments on my answers. Search your own comments for a string. Results show the comment, its score, the date, and a link to the post, newest comments first.
### Response:
|
SELECT Comments.Id AS "comment_link", Comments.CreationDate, Comments.PostId AS "post_link" FROM Comments, Posts AS Answer LEFT JOIN Posts AS Question ON Answer.ParentId = Question.Id WHERE Comments.PostId IN (Answer.Id, Question.Id) AND Answer.Id = Question.AcceptedAnswerId AND Answer.PostTypeId = 2 AND Answer.OwnerUserId = @MyUserID AND Comments.UserId = '##UserID##' AND Comments.Text LIKE '%/questions/5234/how-does-accepting-an-answer-work%' ORDER BY Comments.CreationDate DESC
|
### Instruction:
show me the flights from SAN FRANCISCO to LAS VEGAS
### 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 = 'SAN FRANCISCO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'LAS VEGAS' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
|
### Instruction:
what was the total output of patient 016-9636's ileostomy on this month/29?
### Response:
|
SELECT SUM(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-9636')) AND intakeoutput.celllabel = 'ileostomy' AND intakeoutput.cellpath LIKE '%output%' AND DATETIME(intakeoutput.intakeoutputtime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') AND STRFTIME('%d', intakeoutput.intakeoutputtime) = '29'
|
### Instruction:
what was the last measured value of heartrate for patient 013-9305 on 06/12/last year?
### Response:
|
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 = '013-9305')) AND NOT vitalperiodic.heartrate IS NULL AND DATETIME(vitalperiodic.observationtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m-%d', vitalperiodic.observationtime) = '06-12' ORDER BY vitalperiodic.observationtime DESC LIMIT 1
|
### Instruction:
Most prolific answering user for each tag.
### Response:
|
SELECT UserId, U.DisplayName, TagName, PostCount, RANK() OVER (PARTITION BY TagName ORDER BY PostCount DESC) AS PostCountRank FROM (SELECT COUNT(C.PostId) AS PostCount, C.UserId, C.UserDisplayName, T.TagName FROM Comments AS C INNER JOIN Posts AS P ON C.Id = P.AcceptedAnswerId INNER JOIN PostTags AS PT ON P.Id = PT.PostId INNER JOIN Tags AS T ON T.Id = PT.TagId WHERE T.TagName IN ('general-relativity', 'quantum-mechanics', 'electromagnetism') GROUP BY C.UserId, C.UserDisplayName, T.TagName) AS sub LEFT JOIN Users AS U ON UserId = U.Id ORDER BY PostCountRank LIMIT 70
|
### Instruction:
i would like to fly to SAN FRANCISCO from WASHINGTON
### 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 = 'SAN FRANCISCO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
|
### Instruction:
when was patient 005-11182 prescribed with a drug via intraven route for the first time in 09/last year?
### 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 = '005-11182')) AND medication.routeadmin = 'intraven' AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', medication.drugstarttime) = '09' ORDER BY medication.drugstarttime LIMIT 1
|
### Instruction:
what is the transportation time from the airport to BOSTON
### Response:
|
SELECT DISTINCT AIRPORT_SERVICE_0.minutes_distant FROM airport, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1 WHERE airport.airport_code = AIRPORT_SERVICE_0.airport_code AND airport.airport_code = AIRPORT_SERVICE_1.airport_code AND CITY_0.city_code = AIRPORT_SERVICE_1.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_0.city_code AND CITY_1.city_name = 'BOSTON'
|
### Instruction:
was there any results of microbiology tests for the urine, catheter specimen of patient 031-1337 in 05/this year?
### Response:
|
SELECT COUNT(*) FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-1337')) AND microlab.culturesite = 'urine, catheter specimen' AND DATETIME(microlab.culturetakentime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', microlab.culturetakentime) = '05'
|
### Instruction:
did patient 8204 excreted any of his wound vac #1 in 06/this year?
### Response:
|
SELECT COUNT(*) > 0 FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 8204)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'wound vac #1' AND d_items.linksto = 'outputevents') AND DATETIME(outputevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', outputevents.charttime) = '06'
|
### Instruction:
provide the daily maximum amount of po intake that patient 23436 has received on the first icu visit.
### Response:
|
SELECT MAX(inputevents_cv.amount) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 23436) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'po intake' AND d_items.linksto = 'inputevents_cv') GROUP BY STRFTIME('%y-%m-%d', inputevents_cv.charttime)
|
### Instruction:
had the respiratory rate of patient 2514 been greater until 172 months ago than 19.0?
### 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 = 2514)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'respiratory rate' AND d_items.linksto = 'chartevents') AND chartevents.valuenum > 19.0 AND DATETIME(chartevents.charttime) <= DATETIME(CURRENT_TIME(), '-172 month')
|
### Instruction:
when was patient 010-19726 prescribed 500 ml flex cont : sodium chloride 0.9 % iv soln last until 47 months ago?
### 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 = '010-19726')) AND medication.drugname = '500 ml flex cont : sodium chloride 0.9 % iv soln' AND DATETIME(medication.drugstarttime) <= DATETIME(CURRENT_TIME(), '-47 month') ORDER BY medication.drugstarttime DESC LIMIT 1
|
### Instruction:
show me the flights from PITTSBURGH to BALTIMORE
### 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 = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALTIMORE' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
|
### Instruction:
when was last time the respiratory rate of patient 12775 was less than 19.0 on the current icu visit?
### 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 = 12775) AND icustays.outtime IS NULL) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'respiratory rate' AND d_items.linksto = 'chartevents') AND chartevents.valuenum < 19.0 ORDER BY chartevents.charttime DESC LIMIT 1
|
### Instruction:
Closed and edited questions by month.
### Response:
|
SELECT TIME_TO_STR(e.CreationDate, '%M') AS "month", TIME_TO_STR(e.CreationDate, '%Y') AS "year", COUNT(DISTINCT e.PostId) AS closes FROM PostHistory AS c JOIN PostHistory AS e ON e.PostId = c.PostId WHERE c.CreationDate < e.CreationDate AND c.PostHistoryTypeId = 10 AND (e.PostHistoryTypeId = 4 OR e.PostHistoryTypeId = 5) GROUP BY TIME_TO_STR(e.CreationDate, '%M'), TIME_TO_STR(e.CreationDate, '%Y') ORDER BY TIME_TO_STR(e.CreationDate, '%Y'), TIME_TO_STR(e.CreationDate, '%M')
|
### Instruction:
what are the new prescriptions of patient 55360 today compared with the prescriptions yesterday?
### Response:
|
SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 55360) AND DATETIME(prescriptions.startdate, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 55360) AND DATETIME(prescriptions.startdate, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-1 day')
|
### Instruction:
Quickest new contributor answers to new contributor questions.
### Response:
|
WITH FirstPosts AS (SELECT MIN(Id) AS PostId FROM Posts WHERE OwnerUserId > 0 GROUP BY OwnerUserId) SELECT A.Id AS "post_link", Q.OwnerUserId AS "user_link", A.OwnerUserId AS "user_link", CAST((JULIANDAY(A.CreationDate) - JULIANDAY(Q.CreationDate)) AS INT) AS Seconds FROM Posts AS Q, Posts AS A WHERE A.ParentId = Q.Id AND Q.Id IN (SELECT PostId FROM FirstPosts) AND A.Id IN (SELECT PostId FROM FirstPosts) AND Q.OwnerUserId != A.OwnerUserId AND Q.CreationDate < A.CreationDate ORDER BY Seconds, A.Id LIMIT 100
|
### Instruction:
what's the name of the specimen test that patient 031-15666 was given for the first time in 12/last year?
### Response:
|
SELECT microlab.culturesite FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-15666')) AND DATETIME(microlab.culturetakentime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', microlab.culturetakentime) = '12' ORDER BY microlab.culturetakentime LIMIT 1
|
### Instruction:
what were the first outputs of patient 016-27397 on 12/22/this year?
### Response:
|
SELECT intakeoutput.celllabel FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-27397')) AND intakeoutput.cellpath LIKE '%output%' AND DATETIME(intakeoutput.intakeoutputtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m-%d', intakeoutput.intakeoutputtime) = '12-22' ORDER BY intakeoutput.intakeoutputtime LIMIT 1
|
### Instruction:
on the first intensive care unit visit, when did patient 022-44805 have the last urinary catheter output: indwelling/continuous ure output?
### Response:
|
SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-44805') AND NOT patient.unitdischargetime IS NULL ORDER BY patient.unitadmittime LIMIT 1) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput.celllabel = 'urinary catheter output: indwelling/continuous ure' ORDER BY intakeoutput.intakeoutputtime DESC LIMIT 1
|
### Instruction:
what flights do you have leaving DENVER and arriving in 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 = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
|
### Instruction:
so, what was the last heart rate of patient 28443 in the previous day?
### Response:
|
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 = 28443)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'heart rate' AND d_items.linksto = 'chartevents') AND DATETIME(chartevents.charttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-1 day') ORDER BY chartevents.charttime DESC LIMIT 1
|
### Instruction:
Questions by week by tag.
### Response:
|
SELECT DATEADD(DAY, 0, DATEADD(DAY, -DATEPART(DW, CAST('1/1/' + CAST(Year AS VARCHAR) AS DATE)) + 2, DATEADD(WK, Week - 1, CAST('1/1/' + CAST(Year AS VARCHAR) AS DATE)))) AS Date, Questions FROM (SELECT DATEPART(YYYY, Posts.CreationDate) AS Year, DATEPART(WW, Posts.CreationDate) AS Week, COUNT(*) AS Questions FROM Posts WHERE PostTypeId = 1 AND Id IN (SELECT PostId FROM PostTags WHERE TagId IN (SELECT Id FROM Tags WHERE TagName = 'typescript')) GROUP BY DATEPART(YYYY, Posts.CreationDate), DATEPART(WW, Posts.CreationDate)) AS x ORDER BY 1
|
### Instruction:
when did patient 22648 first take his/her d5w during a day before?
### Response:
|
SELECT inputevents_cv.charttime FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 22648)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'd5w' AND d_items.linksto = 'inputevents_cv') AND DATETIME(inputevents_cv.charttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-1 day') ORDER BY inputevents_cv.charttime LIMIT 1
|
### Instruction:
what is the daily minimum of urine output of patient 033-3992 since 08/31/2104?
### Response:
|
SELECT MIN(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '033-3992')) AND intakeoutput.celllabel = 'urine' AND intakeoutput.cellpath LIKE '%output%' AND STRFTIME('%y-%m-%d', intakeoutput.intakeoutputtime) >= '2104-08-31' GROUP BY STRFTIME('%y-%m-%d', intakeoutput.intakeoutputtime)
|
### Instruction:
Tags: Spelling variants (AE/BE: o/ou).
### Response:
|
WITH PostCounts AS (SELECT Tags.Id AS TagId, COUNT(Posts.Id) AS PostCount FROM Posts INNER JOIN PostTags ON Posts.Id = PostTags.PostId INNER JOIN Tags ON PostTags.TagId = Tags.Id GROUP BY Tags.Id), Variants AS (SELECT * FROM (SELECT REPLACE(TagName, 'ou', 'o') AS vname, * FROM Tags) AS r WHERE vname != TagName) SELECT Tags.TagName, tc.PostCount, Variants.TagName, vc.PostCount FROM Tags INNER JOIN Variants ON Tags.TagName = Variants.vname INNER JOIN PostCounts AS tc ON Tags.Id = tc.TagId INNER JOIN PostCounts AS vc ON Variants.Id = vc.TagId ORDER BY vc.PostCount DESC
|
### Instruction:
when was the heartrate of patient 032-25571 first measured on 09/06/this year?
### Response:
|
SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '032-25571')) AND NOT vitalperiodic.heartrate IS NULL AND DATETIME(vitalperiodic.observationtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m-%d', vitalperiodic.observationtime) = '09-06' ORDER BY vitalperiodic.observationtime LIMIT 1
|
### Instruction:
All my answers sort score , viewcount, creationDate. All my answers on the site
### Response:
|
SELECT * FROM (SELECT q.Id AS aid, a.Id AS "post_link", CASE WHEN q.AcceptedAnswerId = a.Id THEN 'Accepted' END AS Accepted, a.Score FROM Posts AS q INNER JOIN Posts AS a ON q.Id = a.ParentId WHERE a.OwnerUserId = @UserId AND a.PostTypeId = 2) AS AA INNER JOIN (SELECT DISTINCT Question.Id AS bid, Question.CreationDate AS "date", Question.ViewCount FROM Posts AS Answers, Posts AS Question WHERE Answers.PostTypeId = 2 AND Answers.OwnerUserId = @UserId AND Question.Id = Answers.ParentId) AS BB ON AA.aid = BB.bid ORDER BY Score, ViewCount DESC, DATE
|
### Instruction:
what is the total urine . output amount that patient 73713 had on last month/04?
### Response:
|
SELECT SUM(outputevents.value) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 73713)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'urine .' AND d_items.linksto = 'outputevents') AND DATETIME(outputevents.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') AND STRFTIME('%d', outputevents.charttime) = '04'
|
### Instruction:
Average answer length per user > 10K rep..
### Response:
|
SELECT u.Id AS "user_link", COUNT(*) AS "answer_count", MIN(LENGTH(p.Body)) AS "min", AVG(LENGTH(p.Body)) AS "average", MAX(LENGTH(p.Body)) AS "max", VAR(LENGTH(p.Body)) AS "variance", STDEV(LENGTH(p.Body)) AS "stdev" FROM Users AS u, Posts AS p WHERE p.OwnerUserId = '##UserID##' AND p.PostTypeId = 2 AND u.Reputation > 10000 /* AND (SELECT Count(*) FROM Posts q WHERE q.OwnerUserId = u.Id AND p.PostTypeId = 2 GROUP BY q.OwnerUserId) >= 10 */ GROUP BY u.Id ORDER BY 'average'
|
### Instruction:
had patient 035-166 been given any p.o. medication on 04/14/last year?
### Response:
|
SELECT COUNT(*) > 0 FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '035-166')) AND intakeoutput.cellpath LIKE '%intake%' AND intakeoutput.celllabel = 'p.o.' AND DATETIME(intakeoutput.intakeoutputtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m-%d', intakeoutput.intakeoutputtime) = '04-14'
|
### Instruction:
had a albuterol concentrated 0.5%, lorazepam, or magnesium sulfate been prescribed for patient 016-18575 in this year?
### Response:
|
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-18575')) AND medication.drugname IN ('albuterol concentrated 0.5%', 'lorazepam', 'magnesium sulfate') AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
|
### Instruction:
i would like to see the flights from DENVER to PHILADELPHIA
### 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 = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILADELPHIA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
|
### Instruction:
tell me what was the top five most common procedures of the patients 60 or above until 2103?
### Response:
|
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age >= 60) AND STRFTIME('%y', procedures_icd.charttime) <= '2103' GROUP BY procedures_icd.icd9_code) AS t1 WHERE t1.c1 <= 5)
|
### Instruction:
when was the first time patient 25997 had a drug intake of carrier until 1062 days ago?
### Response:
|
SELECT inputevents_cv.charttime FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 25997)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'carrier' AND d_items.linksto = 'inputevents_cv') AND DATETIME(inputevents_cv.charttime) <= DATETIME(CURRENT_TIME(), '-1062 day') ORDER BY inputevents_cv.charttime LIMIT 1
|
### Instruction:
i was wondering what patient 022-47232's average value of systemicmean on 01/13/this year was?
### Response:
|
SELECT AVG(vitalperiodic.systemicmean) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-47232')) AND NOT vitalperiodic.systemicmean IS NULL AND DATETIME(vitalperiodic.observationtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m-%d', vitalperiodic.observationtime) = '01-13'
|
### Instruction:
what was the last respiration of patient 030-64961 on 11/30/last year.
### Response:
|
SELECT vitalperiodic.respiration FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-64961')) AND NOT vitalperiodic.respiration IS NULL AND DATETIME(vitalperiodic.observationtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m-%d', vitalperiodic.observationtime) = '11-30' ORDER BY vitalperiodic.observationtime DESC LIMIT 1
|
### Instruction:
did patient 18866's arterial bp mean ever be greater than 69.0 on the last icu visit?
### 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 = 18866) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime DESC LIMIT 1) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp mean' AND d_items.linksto = 'chartevents') AND chartevents.valuenum > 69.0
|
### Instruction:
Closed Questions with A Given Tag.
### Response:
|
SELECT DISTINCT p.Id FROM Posts AS p INNER JOIN PostHistory AS ph ON ph.PostId = p.Id INNER JOIN PostHistoryTypes AS pht ON ph.PostHistoryTypeId = pht.Id INNER JOIN PostTags AS pt ON p.Id = pt.PostId INNER JOIN Tags AS t ON pt.TagId = t.Id AND (t.TagName LIKE 'c#' OR t.TagName LIKE 'asp.net%' OR t.TagName LIKE 'powershell' OR t.TagName LIKE 'sql-server%' OR t.TagName LIKE 'excel%' OR t.TagName LIKE 'csv%') WHERE NOT p.ClosedDate IS NULL AND pht.Name = 'Post Closed' AND ph.Comment = '102' AND p.CreationDate > '01 Jan 2016' ORDER BY p.Id DESC
|
### Instruction:
okay i would like to fly from ATLANTA to PHILADELPHIA
### 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 = 'ATLANTA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILADELPHIA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
|
### Instruction:
Which tags are most active during weekends?. Only tags with more than N questions are considered.
### Response:
|
SELECT MIN(t.TagName) AS "tagname", COUNT(*) AS total, SUM(CASE WHEN TIME_TO_STR(CreationDate, '%W') IN (1, 7) THEN 1 ELSE 0 END) AS weekend, CAST(SUM(CASE WHEN TIME_TO_STR(CreationDate, '%W') IN (1, 7) THEN 1 ELSE 0 END) AS FLOAT(15, 6)) / COUNT(*) AS ratio FROM Posts AS p INNER JOIN PostTags AS pt ON p.Id = pt.PostId INNER JOIN Tags AS t ON pt.TagId = t.Id WHERE p.PostTypeId = 1 AND YEAR(p.CreationDate) = 2019 GROUP BY t.Id ORDER BY total DESC
|
### Instruction:
Longest Answers by Markdown for Mark S..
### Response:
|
SELECT p.Id AS "post_link", LENGTH(ph.Text) AS "markdown_length", p.Score AS "score" FROM Posts AS p, PostHistory AS ph WHERE YEAR(p.CreationDate) >= 2011 AND p.PostTypeId = 2 AND ph.PostId = p.Id AND ph.PostHistoryTypeId IN (2, 5, 8) AND NOT EXISTS(SELECT * FROM PostHistory AS phtwo WHERE phtwo.PostId = p.Id AND phtwo.PostHistoryTypeId IN (2, 5, 8) AND phtwo.CreationDate > ph.CreationDate) AND p.OwnerUserId = 609441 ORDER BY LENGTH(ph.Text) DESC LIMIT 300
|
### Instruction:
has there ever been any enteral meds given to patient 027-154299 on this month/27?
### Response:
|
SELECT COUNT(*) > 0 FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-154299')) AND intakeoutput.cellpath LIKE '%intake%' AND intakeoutput.celllabel = 'enteral meds' AND DATETIME(intakeoutput.intakeoutputtime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') AND STRFTIME('%d', intakeoutput.intakeoutputtime) = '27'
|
### Instruction:
when was the last time until 06/06/2101 patient 002-25577's systemicmean was greater than 115.0?
### Response:
|
SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-25577')) AND vitalperiodic.systemicmean > 115.0 AND NOT vitalperiodic.systemicmean IS NULL AND STRFTIME('%y-%m-%d', vitalperiodic.observationtime) <= '2101-06-06' ORDER BY vitalperiodic.observationtime DESC LIMIT 1
|
### Instruction:
Unanswered questions migrated to dba.se.
### Response:
|
SELECT COUNT(p.Id) FROM Posts AS p JOIN PostTypes AS pt ON p.PostTypeId = pt.Id AND pt.Name = 'Question' JOIN PostHistory AS ph ON ph.PostId = p.Id JOIN PostHistoryTypes AS pht ON pht.Id = ph.PostHistoryTypeId AND pht.Name = 'Post Migrated Here' WHERE EXISTS(SELECT 1 FROM Posts AS ap JOIN PostTypes AS apt ON apt.Id = ap.PostTypeId AND apt.Name = 'Answer' WHERE ap.ParentId = p.Id) AND NOT EXISTS(SELECT 1 FROM Posts AS ap JOIN PostTypes AS apt ON apt.Id = ap.PostTypeId AND apt.Name = 'Answer' WHERE ap.ParentId = p.Id AND ap.CreationDate >= ph.CreationDate)
|
### Instruction:
can you list all flights that depart from ORLANDO to KANSAS 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, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ORLANDO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'KANSAS CITY' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
|
### Instruction:
indicate the daily maximum sao2 of patient 12454 on the last icu visit.
### Response:
|
SELECT MAX(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 = 12454) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime DESC LIMIT 1) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'sao2' AND d_items.linksto = 'chartevents') GROUP BY STRFTIME('%y-%m-%d', chartevents.charttime)
|
### Instruction:
My unaccepted answers with non-zero probability of acceptance.
### Response:
|
SELECT Q.Id AS "post_link" FROM Posts AS Q INNER JOIN Posts AS A ON (Q.Id = A.ParentId) INNER JOIN Users AS U ON (Q.OwnerUserId = U.Id) WHERE Q.PostTypeId = 1 AND A.PostTypeId = 2 AND A.OwnerUserId = @UserId AND Q.AcceptedAnswerId IS NULL AND Q.ClosedDate IS NULL AND NOT EXISTS(SELECT A2.Id FROM Posts AS A2 WHERE A2.PostTypeId = 2 AND A2.ParentId = Q.Id AND A2.Id != A.Id AND A2.Score > A.Score) AND U.LastAccessDate >= DATEADD(DAY, '##ActivityThreshold##', Q.CreationDate) ORDER BY A.CreationDate
|
### Instruction:
User ranking for questions only, simple - no check for CW or rep cap.
### Response:
|
SELECT p.OwnerUserId AS "user_link", COUNT(DISTINCT p.Id) AS "total_questions", SUM(CASE WHEN VoteTypeId = 2 THEN 5 WHEN VoteTypeId = 3 THEN -2 END) + (SELECT COUNT(*) FROM Posts AS acc WHERE acc.OwnerUserId = p.OwnerUserId AND NOT AcceptedAnswerId IS NULL) * 2 AS "total_reputation" FROM Posts AS p INNER JOIN Votes AS v ON v.PostId = p.Id AND v.VoteTypeId IN (2, 3) WHERE NOT p.OwnerUserId IS NULL AND p.OwnerUserId > 0 AND p.PostTypeId = 1 GROUP BY p.OwnerUserId ORDER BY 'total_reputation' DESC LIMIT 100
|
### Instruction:
show me flights from PHILADELPHIA to BALTIMORE
### 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 = 'PHILADELPHIA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALTIMORE' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
|
### Instruction:
what is patient 17462's new prescription today compared to the prescription given yesterday?
### Response:
|
SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 17462) AND DATETIME(prescriptions.startdate, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 17462) AND DATETIME(prescriptions.startdate, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-1 day')
|
### Instruction:
how many hours have passed since the first time patient 006-181433 received a prescription for cetirizine 10 mg oral tab on this hospital visit?
### Response:
|
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', 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 = '006-181433') AND patient.hospitaldischargetime IS NULL) AND medication.drugname = 'cetirizine 10 mg oral tab' ORDER BY medication.drugstarttime LIMIT 1
|
### Instruction:
count the number of times patient 006-116961 has had in 03/2103 a output y (ml)-chest tube y - a #1 mid b #2 mid output.
### Response:
|
SELECT COUNT(*) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-116961')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput.celllabel = 'output y (ml)-chest tube y - a #1 mid b #2 mid' AND STRFTIME('%y-%m', intakeoutput.intakeoutputtime) = '2103-03'
|
### Instruction:
My acceptance criteria in suggested edits review. http://meta.stackexchange.com/questions/187083/how-is-my-acceptance-criteria-in-suggested-edits-review-compared-with-the-comu
### Response:
|
SELECT CASE WHEN mine.VoteTypeId = 2 THEN 'approve' ELSE 'reject' END AS "mine", CASE WHEN theirs.VoteTypeId = 2 THEN 'approve' ELSE 'reject' END AS "theirs", COUNT(*) AS "cnt" FROM SuggestedEditVotes AS mine INNER JOIN SuggestedEditVotes AS theirs ON theirs.SuggestedEditId = mine.SuggestedEditId WHERE mine.UserId = '##UserId##' AND theirs.Id != mine.Id GROUP BY mine.VoteTypeId, theirs.VoteTypeId
|
### Instruction:
what was the name of the output which patient 017-20711 had for the last time on last month/13?
### Response:
|
SELECT intakeoutput.celllabel FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-20711')) AND intakeoutput.cellpath LIKE '%output%' AND DATETIME(intakeoutput.intakeoutputtime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') AND STRFTIME('%d', intakeoutput.intakeoutputtime) = '13' ORDER BY intakeoutput.intakeoutputtime DESC LIMIT 1
|
### Instruction:
what are the drugs that are added to patient 99883 today compared with the ones yesterday?
### Response:
|
SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 99883) AND DATETIME(prescriptions.startdate, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 99883) AND DATETIME(prescriptions.startdate, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-1 day')
|
### Instruction:
What times is 398 taught during the Winter terms ?
### Response:
|
SELECT DISTINCT course_offering.end_time, course_offering.friday, course_offering.monday, course_offering.saturday, course_offering.start_time, course_offering.sunday, course_offering.thursday, course_offering.tuesday, course_offering.wednesday FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number = 398 AND semester.semester IN ('SP', 'Winter', 'SS') AND semester.semester_id = course_offering.semester AND semester.year = 2016
|
### Instruction:
what is patient 3125's average arterial bp mean, since 12/15/2105?
### Response:
|
SELECT AVG(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 = 3125)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp mean' AND d_items.linksto = 'chartevents') AND STRFTIME('%y-%m-%d', chartevents.charttime) >= '2105-12-15'
|
### Instruction:
give me flights from PITTSBURGH to BALTIMORE
### 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 = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALTIMORE' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
|
### Instruction:
count the number of patients who underwent sm bowel exteriorization two or more times a year before.
### Response:
|
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, COUNT(*) AS c1 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 = 'sm bowel exteriorization') AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY admissions.subject_id) AS t1 WHERE t1.c1 >= 2
|
### Instruction:
what is the monthly minimum of ventric #1 output of patient 006-167444 until 02/2102?
### Response:
|
SELECT MIN(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-167444')) AND intakeoutput.celllabel = 'ventric #1' AND intakeoutput.cellpath LIKE '%output%' AND STRFTIME('%y-%m', intakeoutput.intakeoutputtime) <= '2102-02' GROUP BY STRFTIME('%y-%m', intakeoutput.intakeoutputtime)
|
### Instruction:
how many patients have received a int insert dual-cham dev procedure two times during this year?
### Response:
|
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, COUNT(*) AS c1 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 = 'int insert dual-cham dev') AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY admissions.subject_id) AS t1 WHERE t1.c1 = 2
|
### Instruction:
how much did patient 8562 weigh last measured in the previous month?
### Response:
|
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 = 8562)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit wt' AND d_items.linksto = 'chartevents') AND DATETIME(chartevents.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') ORDER BY chartevents.charttime DESC LIMIT 1
|
### Instruction:
in 08/this year, when was the last time patient 028-62326 was prescribed a medication via the pr?
### 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 = '028-62326')) AND medication.routeadmin = 'pr' AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', medication.drugstarttime) = '08' ORDER BY medication.drugstarttime DESC LIMIT 1
|
### Instruction:
character-id, object-id posts (Sci Fi SE).
### Response:
|
SELECT MIN(q.CreationDate) AS qda, MIN(q.Tags) AS qgl, 'site://q/' + CAST(q.Id AS TEXT) + '/' + CAST(MIN(m.Id) AS TEXT) + '|' + MIN(q.Title) AS qtl FROM Posts AS q LEFT JOIN (PostTags AS a JOIN Tags AS g ON a.TagId = g.Id) ON q.Id = a.PostId LEFT JOIN Users AS m ON m.AccountId = 1192385 WHERE q.PostTypeId = 1 AND g.TagName IN ('character-identification', 'object-identification', 'actor-identification', 'scene-identification') GROUP BY q.Id ORDER BY qda, q.Id
|
### Instruction:
how many hours have elapsed since the first time patient 027-178044 received a anticoagulant administration - low molecular weight heparin treatment in this hospital visit?
### Response:
|
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-178044' AND patient.hospitaldischargetime IS NULL)) AND treatment.treatmentname = 'anticoagulant administration - low molecular weight heparin' ORDER BY treatment.treatmenttime LIMIT 1
|
### Instruction:
count the number of patients who had had a open incis hern-grft nec procedure done two or more times since 2104.
### Response:
|
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, COUNT(*) AS c1 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 = 'open incis hern-grft nec') AND STRFTIME('%y', procedures_icd.charttime) >= '2104' GROUP BY admissions.subject_id) AS t1 WHERE t1.c1 >= 2
|
### Instruction:
tell me about flights from TORONTO 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, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'TORONTO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SALT LAKE CITY' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
|
### Instruction:
what is the new medicine prescribed for patient 99647 today compared to the drug yesterday?
### Response:
|
SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 99647) AND DATETIME(prescriptions.startdate, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 99647) AND DATETIME(prescriptions.startdate, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-1 day')
|
### Instruction:
TOP 100 Mejor promedio en respuestas.
### Response:
|
SELECT ROW_NUMBER() OVER (ORDER BY (SUM(P.Score) * 1.0) / COUNT(P.Id) DESC) AS "ranking", U.Id AS "user_link", SUM(P.Score) AS "puntaje_total_en_respuestas", COUNT(P.Id) AS "n mero_de_respuestas", ROUND((SUM(P.Score) * 1.0) / COUNT(P.Id), 4) AS "promedio" FROM Posts AS P INNER JOIN Users AS U ON P.OwnerUserId = U.Id WHERE PostTypeId = 2 GROUP BY U.Id HAVING COUNT(P.Id) >= 10 ORDER BY 'promedio' DESC LIMIT 100
|
### Instruction:
during the first hospital encounter, what was the daily maximum dose of enteral 2 cal hn of patient 017-55081?
### Response:
|
SELECT MAX(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-55081' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1)) AND intakeoutput.celllabel = 'enteral 2 cal hn' AND intakeoutput.cellpath LIKE '%intake%' GROUP BY STRFTIME('%y-%m-%d', intakeoutput.intakeoutputtime)
|
### Instruction:
what was the name of the last intake that patient 016-18150 on last month/03 had?
### Response:
|
SELECT intakeoutput.celllabel FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-18150')) AND intakeoutput.cellpath LIKE '%intake%' AND DATETIME(intakeoutput.intakeoutputtime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') AND STRFTIME('%d', intakeoutput.intakeoutputtime) = '03' ORDER BY intakeoutput.intakeoutputtime DESC LIMIT 1
|
### Instruction:
so whats the last weight of patient 15447 this month?
### Response:
|
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 = 15447)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit wt' AND d_items.linksto = 'chartevents') AND DATETIME(chartevents.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') ORDER BY chartevents.charttime DESC LIMIT 1
|
### Instruction:
how many times has patient 016-30273 generated a urine output on 03/15/last year?
### Response:
|
SELECT COUNT(*) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-30273')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput.celllabel = 'urine' AND DATETIME(intakeoutput.intakeoutputtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m-%d', intakeoutput.intakeoutputtime) = '03-15'
|
### Instruction:
what flights from SALT LAKE CITY to LAS VEGAS
### 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 = 'SALT LAKE CITY' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'LAS VEGAS' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
|
### Instruction:
SFMC related questions with answers.
### Response:
|
SELECT P.Id AS "post_link", P.PostTypeId, P.Title, P.Body, P.Tags, P.AnswerCount, P.CommentCount, C.Text, C.Score, C.Id, P.CreationDate, P.Score, P.ViewCount, P.OwnerUserId, P.LastEditDate, P.LastActivityDate FROM Posts AS P INNER JOIN Comments AS C ON P.Id = C.PostId WHERE P.PostTypeId = 1 AND (P.Tags LIKE '%##tag1##%' OR P.Tags LIKE '%##tag2##%' OR P.Tags LIKE '%##tag3##%' OR P.Tags LIKE '%##tag4##%' OR P.Tags LIKE '%##tag5##%' OR P.Tags LIKE '##tag6##') ORDER BY P.CreationDate DESC
|
### Instruction:
what are the newly prescribed medicines of patient 42473 today compared to that yesterday?
### Response:
|
SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 42473) AND DATETIME(prescriptions.startdate, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 42473) AND DATETIME(prescriptions.startdate, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-1 day')
|
### Instruction:
StackOverflow tags relating to my job.
### 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 GROUP BY TagName) AS rate INNER JOIN (SELECT COUNT(PostId) AS Num, TagName FROM Tags, PostTags, Posts WHERE Tags.Id = PostTags.TagId AND Posts.Id = PostId GROUP BY TagName HAVING COUNT(PostId) > 800) AS num ON rate.TagName = num.TagName ORDER BY rate.rate DESC
|
### Instruction:
when did patient 010-3286 first get his heartrate measured on 11/18/this year?
### Response:
|
SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-3286')) AND NOT vitalperiodic.heartrate IS NULL AND DATETIME(vitalperiodic.observationtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m-%d', vitalperiodic.observationtime) = '11-18' ORDER BY vitalperiodic.observationtime LIMIT 1
|
### Instruction:
show me all flights from ATLANTA 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 = 'ATLANTA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
|
### Instruction:
when was patient 006-171217 prescribed a medication via po route for the first time in 01/last year?
### 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 = '006-171217')) AND medication.routeadmin = 'po' AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', medication.drugstarttime) = '01' ORDER BY medication.drugstarttime LIMIT 1
|
### Instruction:
what were the five most common procedures ordered in patients of age 60 or above until 2101?
### Response:
|
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age >= 60) AND STRFTIME('%y', procedures_icd.charttime) <= '2101' GROUP BY procedures_icd.icd9_code) AS t1 WHERE t1.c1 <= 5)
|
### Instruction:
have heartrate's of patient 016-19759 been greater than 100.0 on last month/30?
### Response:
|
SELECT COUNT(*) > 0 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-19759')) AND vitalperiodic.heartrate > 100.0 AND NOT vitalperiodic.heartrate IS NULL AND DATETIME(vitalperiodic.observationtime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') AND STRFTIME('%d', vitalperiodic.observationtime) = '30'
|
### Instruction:
show me all flights from SAN FRANCISCO to ATLANTA
### 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 = 'SAN FRANCISCO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
|
### Instruction:
Most efficient answerers grouped by the number of answers.
### Response:
|
SELECT cu.Id AS "user_link", cu.answers_count, cu.total_score, cu.avg_score FROM (SELECT vu.Id, vu.answers_count, vu.total_score, vu.avg_score, ROW_NUMBER() OVER (PARTITION BY answers_count ORDER BY avg_score DESC) AS rank FROM (SELECT u.Id, COUNT(1) AS answers_count, SUM(a.Score) AS total_score, SUM(a.Score) * 1.0 / COUNT(1) AS avg_score FROM Users AS u JOIN Posts AS a ON u.Id = a.OwnerUserId AND a.PostTypeId = 2 GROUP BY u.Id) AS vu) AS cu WHERE cu.rank = 1 ORDER BY cu.answers_count
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.