instruction
stringlengths 37
754
| output
stringlengths 9
3.43k
|
---|---|
### Instruction:
st elevation >= 1 mm ( >= 0.1 mv ) in two contiguous limb leads or >= 2 mm ( >= 0.2 mv ) in two contiguous precordial leads
### Response:
|
SELECT * FROM table_dev_59 WHERE (st_elevation >= 1 AND tow_contiguous_limb = 1) OR (st_elevation >= 2 AND two_contiguous_precordial_leads = 1)
|
### Instruction:
How close am I to the Sportsmanship badge?. Count number of votes on competing answers
### Response:
|
WITH UserPosts AS (SELECT Id AS PostId FROM Posts WHERE OwnerUserId = @UserId AND CommunityOwnedDate IS NULL AND PostTypeId = 2 AND Score >= 1) SELECT DISTINCT UserPosts.PostId FROM UserPosts INNER JOIN Votes ON Votes.PostId = UserPosts.PostId WHERE VoteTypeId = 2
|
### Instruction:
Sum of top 1% of view counts (for real) [in last month].
### Response:
|
SELECT COUNT(*), SUM(CAST(subq.ViewCount AS INT)) FROM (SELECT ViewCount, Id FROM Posts WHERE ViewCount > 0 AND PostTypeId = 1 AND ClosedDate IS NULL AND CommunityOwnedDate IS NULL AND STR_POSITION(Tags, '<python>') > 0 ORDER BY ViewCount DESC LIMIT 1000000) AS subq
|
### Instruction:
What are the names of customers who have a savings balance lower than their checking balance, and what is the total of their checking and savings balances?
### Response:
|
SELECT T1.name, T3.balance + T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid WHERE T3.balance < T2.balance
|
### Instruction:
Mais visualizada que n o tem resposta em 2017.
### Response:
|
SELECT Id AS "post_link", Score, ViewCount, Title, Body, Tags FROM Posts AS c WHERE ViewCount != 0 AND ParentId IS NULL AND AcceptedAnswerId IS NULL AND Tags LIKE '%<windows-phone%' AND CreationDate BETWEEN '01/01/2017' AND '12/31/2017' ORDER BY ViewCount DESC
|
### Instruction:
how many patients were prescribed with chlorhexidine gluconate 0.12 % mouth/throat soln multidose?
### Response:
|
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'chlorhexidine gluconate 0.12 % mouth/throat soln multidose')
|
### Instruction:
provide the number of patients whose admission type is emergency and diagnoses long title is chronic obstructive asthma, unspecified?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND diagnoses.long_title = "Chronic obstructive asthma, unspecified"
|
### Instruction:
count the number of patients whose diagnoses short title is anorexia and drug route is neb?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Anorexia" AND prescriptions.route = "NEB"
|
### Instruction:
Users with the highest rep to total posts ratio.
### Response:
|
SELECT u.Id, u.DisplayName, u.Reputation, COUNT(*) AS "total_number_of_posts", u.Reputation / COUNT(*) AS Ratio FROM Users AS u JOIN Posts AS p ON p.OwnerUserId = u.Id WHERE p.PostTypeId IN (1, 2) GROUP BY u.Id, u.DisplayName, u.Reputation ORDER BY u.Reputation DESC LIMIT 50
|
### Instruction:
What is the international mail with the lowest number to have less than 72 domestic freight, 0 domestic mail later than 2012 with total freight and mail more than 4,695?
### Response:
|
SELECT MIN(international_mail) FROM table_name_82 WHERE domestic_freight < 72 AND domestic_mail = 0 AND year < 2012 AND total_freight_and_mail > 4 OFFSET 695
|
### Instruction:
how many hours have elapsed since patient 5828 was admitted to the intensive care unit?
### Response:
|
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', icustays.intime)) FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 5828) AND icustays.outtime IS NULL
|
### Instruction:
how many hours has elapsed since patient 83062 was admitted into the icu?
### Response:
|
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', icustays.intime)) FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 83062) AND icustays.outtime IS NULL
|
### Instruction:
when did patient 021-25408 in this year for the last time leave the hospital?
### Response:
|
SELECT patient.hospitaldischargetime FROM patient WHERE patient.uniquepid = '021-25408' AND DATETIME(patient.hospitaldischargetime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') ORDER BY patient.hospitaldischargetime DESC LIMIT 1
|
### Instruction:
count the number of patients whose discharge location is rehab/distinct part hosp and diagnoses short title is injury-hanging?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.discharge_location = "REHAB/DISTINCT PART HOSP" AND diagnoses.short_title = "Injury-hanging"
|
### Instruction:
How much Gross Domestic Product has a US Dollar Exchange of 12.19 algerian dinars, and an Inflation Index (2000=100) larger than 22?
### Response:
|
SELECT SUM("Gross Domestic Product") FROM table_66383 WHERE "US Dollar Exchange" = '12.19 algerian dinars' AND "Inflation Index (2000=100)" > '22'
|
### Instruction:
how many patients whose diagnoses short title is status-post ptca and drug route is neb?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Status-post ptca" AND prescriptions.route = "NEB"
|
### Instruction:
Answer breakdown by which side of score = 10.
### Response:
|
SELECT COUNT(1) AS "total", COUNT(CASE WHEN 'score' >= 10 THEN 1 ELSE NULL END) AS "egt10", COUNT(CASE WHEN 'score' < 10 THEN 1 ELSE NULL END) AS "lg10" FROM Posts WHERE 'posttypeid' = 2 AND 'deletiondate' IS NULL AND 'owneruserid' = '##UserId##'
|
### Instruction:
Count the patients less than 72 years old who have been prescribed aluminum-magnesium hydrox-simethicone.
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "72" AND prescriptions.drug = "Aluminum-Magnesium Hydrox.-Simethicone"
|
### Instruction:
List of all users who downvoted your posts.
### Response:
|
SELECT u.Id AS "user_link", v.VoteTypeId, Reputation, p.Id AS "post_link", p.Score, p.Id, v.PostId FROM Users AS u, Votes AS v, Posts AS p WHERE u.Id = v.UserId AND v.PostId = p.Id AND p.OwnerUserId = '##UserId##' AND VoteTypeId != 5
|
### Instruction:
For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the distribution of email and salary in a bar chart, list in asc by the x-axis.
### Response:
|
SELECT EMAIL, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY EMAIL
|
### Instruction:
What is the 1920 number when 1890 is greater than 1,236, 1910 is less than 1,177 and the city is Vacaville?
### Response:
|
SELECT SUM("1920") FROM table_78668 WHERE "1890" > '1,236' AND "City" = 'vacaville' AND "1910" < '1,177'
|
### Instruction:
Return a bar chart on how many students are older than 20 in each dorm?, list bar from low to high order.
### Response:
|
SELECT dorm_name, COUNT(*) FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid WHERE T1.Age > 20 GROUP BY T3.dorm_name ORDER BY dorm_name
|
### Instruction:
count the number of patients whose year of death is less than or equal to 2115 and drug code is glyb5?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dod_year <= "2115.0" AND prescriptions.formulary_drug_cd = "GLYB5"
|
### Instruction:
Questions with low score and high viewcounts.
### Response:
|
SELECT Posts.Id AS "post_link", Posts.CreationDate, Posts.Score, Posts.ViewCount, PostHistory.CreationDate AS "ProtectedDate" FROM Posts LEFT JOIN PostHistory ON Posts.Id = PostHistory.PostId AND PostHistory.PostHistoryTypeId = 19 WHERE Posts.Score <= 2 ORDER BY Posts.ViewCount DESC LIMIT 100
|
### Instruction:
For those records from the products and each product's manufacturer, find headquarter and the average of code , and group by attribute headquarter, and visualize them by a bar chart, and rank by the total number from low to high.
### Response:
|
SELECT T2.Headquarter, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Headquarter ORDER BY T1.Code
|
### Instruction:
For all employees who have the letters D or S in their first name, a bar chart shows the distribution of job_id and the average of department_id , and group by attribute job_id, and I want to order x-axis in ascending order please.
### Response:
|
SELECT JOB_ID, AVG(DEPARTMENT_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY JOB_ID
|
### Instruction:
in 2105 what was the first care unit of patient 4900?
### Response:
|
SELECT transfers.careunit FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 4900) AND NOT transfers.careunit IS NULL AND STRFTIME('%y', transfers.intime) = '2105' ORDER BY transfers.intime LIMIT 1
|
### Instruction:
how is patient 027-100528 last admitted into a hospital in the previous year?
### Response:
|
SELECT patient.hospitaladmitsource FROM patient WHERE patient.uniquepid = '027-100528' AND DATETIME(patient.hospitaladmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY patient.hospitaladmittime DESC LIMIT 1
|
### Instruction:
Find the parties associated with the delegates from district 1 or 2 Who served as comptrollers of the parties, and count them by a bar chart, and rank in asc by the x axis.
### Response:
|
SELECT Comptroller, COUNT(Comptroller) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 OR T1.District = 2 GROUP BY Comptroller ORDER BY Comptroller
|
### Instruction:
give me the number of patients whose gender is f and procedure long title is allogeneic hematopoietic stem cell transpant without purging?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.gender = "F" AND procedures.long_title = "Allogeneic hematopoietic stem cell transpant without purging"
|
### Instruction:
what number of patients who died in or before 2131 had been prescribed the drug with code cepacol1?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dod_year <= "2131.0" AND prescriptions.formulary_drug_cd = "CEPACOL1"
|
### Instruction:
Give the title and credits for the course that is taught in the classroom with the greatest capacity.
### Response:
|
SELECT T3.title, T3.credits FROM classroom AS T1 JOIN section AS T2 ON T1.building = T2.building AND T1.room_number = T2.room_number JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.capacity = (SELECT MAX(capacity) FROM classroom)
|
### Instruction:
what were the four most commonly performed lab tests during the last year?
### Response:
|
SELECT t1.labname FROM (SELECT lab.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM lab WHERE DATETIME(lab.labresulttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY lab.labname) AS t1 WHERE t1.c1 <= 4
|
### Instruction:
how many patients use the drug code rosi8 and tested with urine in lab?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.formulary_drug_cd = "ROSI8" AND lab.fluid = "Urine"
|
### Instruction:
For those records from the products and each product's manufacturer, return a bar chart about the distribution of name and revenue , and group by attribute headquarter, and could you show from high to low by the X-axis please?
### Response:
|
SELECT T1.Name, T2.Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter, T1.Name ORDER BY T1.Name DESC
|
### Instruction:
count the number of patients whose year of death is less than or equal to 2138 and procedure long title is other diagnostic procedures on nasal sinuses?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2138.0" AND procedures.long_title = "Other diagnostic procedures on nasal sinuses"
|
### Instruction:
For those employees who did not have any job in the past, visualize a bar chart about the distribution of job_id and the sum of salary , and group by attribute job_id, and could you sort x-axis in descending order please?
### Response:
|
SELECT JOB_ID, SUM(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY JOB_ID DESC
|
### Instruction:
Not so hidden gems: Highest score for questions with less than 10,000 views.
### Response:
|
SELECT Posts.Id AS "post_link", Posts.OwnerUserId AS "user_link", Score, ViewCount, Score * 1000 / ViewCount AS "Score per Thousand Views" FROM Posts WHERE ViewCount < 10000 AND PostTypeId = 1 ORDER BY Score DESC LIMIT 1000
|
### Instruction:
which championship had helena sukov tom nijssen as opponents in the final and nicole provis as partner, the surface was hard and the outcome was winner
### Response:
|
SELECT "Championship" FROM table_22879 WHERE "Outcome" = 'Winner' AND "Surface" = 'Hard' AND "Partner" = 'Nicole Provis' AND "Opponents in the final" = 'Helena Suková Tom Nijssen'
|
### Instruction:
what was the first amount of artificial tear ointment that was prescribed to patient 7375?
### Response:
|
SELECT prescriptions.dose_val_rx FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 7375) AND prescriptions.drug = 'artificial tear ointment' ORDER BY prescriptions.startdate LIMIT 1
|
### Instruction:
For those employees who did not have any job in the past, find job_id and the sum of salary , and group by attribute job_id, and visualize them by a bar chart, could you rank sum salary in desc order?
### Response:
|
SELECT JOB_ID, SUM(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY SUM(SALARY) DESC
|
### Instruction:
For all employees who have the letters D or S in their first name, show me about the distribution of hire_date and the sum of department_id bin hire_date by time in a bar chart, I want to list by the sum department id in ascending.
### Response:
|
SELECT HIRE_DATE, SUM(DEPARTMENT_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY SUM(DEPARTMENT_ID)
|
### Instruction:
For those employees who did not have any job in the past, visualize a bar chart about the distribution of job_id and the average of manager_id , and group by attribute job_id, and sort x axis from low to high order.
### Response:
|
SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY JOB_ID
|
### Instruction:
give the number of patients whose death status is 1 and diagnosis long title is contusion of face, scalp, and neck except eye(s).
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "1" AND diagnoses.long_title = "Contusion of face, scalp, and neck except eye(s)"
|
### Instruction:
what are the top three of the most commonly prescribed drugs since 2104?
### Response:
|
SELECT t1.drugname FROM (SELECT medication.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM medication WHERE STRFTIME('%y', medication.drugstarttime) >= '2104' GROUP BY medication.drugname) AS t1 WHERE t1.c1 <= 3
|
### Instruction:
Give the number of patients who were diagnosed with polycethemia vera and have delta as the lab test result.
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Polycythemia vera" AND lab.flag = "delta"
|
### Instruction:
what was the first careunit for patient 1862 until 2102?
### Response:
|
SELECT transfers.careunit FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1862) AND NOT transfers.careunit IS NULL AND STRFTIME('%y', transfers.intime) <= '2102' ORDER BY transfers.intime LIMIT 1
|
### Instruction:
What Globalizing Consumer Cultures classes have no prerequisites ?
### Response:
|
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN area ON course.course_id = area.course_id WHERE (area.area LIKE '%Globalizing Consumer Cultures%' OR course.description LIKE '%Globalizing Consumer Cultures%' OR course.name LIKE '%Globalizing Consumer Cultures%') AND course.enforced_requirement = 'N / A'
|
### Instruction:
Who is the h.h. principal with Jim Haught as h.s. principal, Charlie Taylor as maplemere principal, and Rich Auerbach as w.r. principal?
### Response:
|
SELECT "H.H. Principal" FROM table_66897 WHERE "H.S. Principal" = 'jim haught' AND "Maplemere Principal" = 'charlie taylor' AND "W.R. Principal" = 'rich auerbach'
|
### Instruction:
Show the role description and the id of the project staff involved in most number of project outcomes?
### Response:
|
SELECT T1.role_description, T2.staff_id FROM staff_roles AS T1 JOIN project_staff AS T2 ON T1.role_code = T2.role_code JOIN project_outcomes AS T3 ON T2.project_id = T3.project_id GROUP BY T2.staff_id ORDER BY COUNT(*) DESC LIMIT 1
|
### Instruction:
Yearly average questions per day.
### Response:
|
SELECT YEAR(CreationDate) * 12 + MONTH(CreationDate) AS MonthNumber, CAST(COUNT(*) AS FLOAT) / 30 AS "Approximate Questions Per Day" FROM Posts WHERE PostTypeId = 1 GROUP BY YEAR(CreationDate), MONTH(CreationDate) ORDER BY YEAR(CreationDate) DESC, MONTH(CreationDate) DESC
|
### Instruction:
Which september 26 28, 2011 polling firm had a Link of html, less than 36 liberals, and less than 8 green?
### Response:
|
SELECT "Polling Firm" FROM table_35786 WHERE "Link" = 'html' AND "Liberal" < '36' AND "Green" < '8' AND "Date of Polling" = 'september 26–28, 2011'
|
### Instruction:
Among all the claims, which claims have a claimed amount larger than the average? Please Bin the date it was settled into weekday interval and count them to show a bar chart, and show by the total number in ascending.
### Response:
|
SELECT Date_Claim_Settled, COUNT(Date_Claim_Settled) FROM Claims WHERE Amount_Claimed > (SELECT AVG(Amount_Claimed) FROM Claims) ORDER BY COUNT(Date_Claim_Settled)
|
### Instruction:
Calculate the average age of home discharged patients who have aortic insufficiency re-do sternotomy aortic valve replacement as their primary disease.
### Response:
|
SELECT AVG(demographic.age) FROM demographic WHERE demographic.discharge_location = "HOME" AND demographic.diagnosis = "AORTIC INSUFFICIENCY\RE-DO STERNOTOMY; AORTIC VALVE REPLACEMENT "
|
### Instruction:
what are the three top most commonly prescribed drugs until 4 years ago?
### Response:
|
SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions WHERE DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-4 year') GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 <= 3
|
### Instruction:
count the number of patients whose year of death is less than or equal to 2126 and drug code is ggac5l?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dod_year <= "2126.0" AND prescriptions.formulary_drug_cd = "GGAC5L"
|
### Instruction:
among patients with other preterm infants 1,750-1,999 grams how many of them were male?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "M" AND diagnoses.long_title = "Other preterm infants, 1,750-1,999 grams"
|
### Instruction:
how many patients whose admission location is emergency room admit and drug code is dapt500i?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND prescriptions.formulary_drug_cd = "DAPT500I"
|
### Instruction:
what is the number of patients whose discharge location is dead/expired and procedure short title is exc/des hrt les,endovasc?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "DEAD/EXPIRED" AND procedures.short_title = "Exc/des hrt les,endovasc"
|
### Instruction:
For those employees who was hired before 2002-06-21, show me about the distribution of job_id and the sum of salary , and group by attribute job_id in a bar chart, could you rank Y in ascending order?
### Response:
|
SELECT JOB_ID, SUM(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY SUM(SALARY)
|
### Instruction:
give the number of patients whose diagnosis short title is epistaxis and lab test category is chemistry.
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Epistaxis" AND lab."CATEGORY" = "Chemistry"
|
### Instruction:
Show the names of pilots and fleet series of the aircrafts they have flied with in ascending order of the rank of the pilot.
### Response:
|
SELECT T3.pilot_name, T2.fleet_series FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.aircraft_id = T2.aircraft_id JOIN pilot AS T3 ON T1.pilot_id = T3.pilot_id ORDER BY T3.rank
|
### Instruction:
Which Type has a Date smaller than 1943, and a Builder of alco schenectady, and a Number larger than 822, and Works number of 59867?
### Response:
|
SELECT "Type" FROM table_5556 WHERE "Date" < '1943' AND "Builder" = 'alco schenectady' AND "Number" > '822' AND "Works number" = '59867'
|
### Instruction:
provide the number of patients who had hydromorphone (dilaudid) prescription and stayed in hospital for more than 30 days.
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "30" AND prescriptions.drug = "HYDROmorphone (Dilaudid)"
|
### Instruction:
People helped - By user and date range.
### Response:
|
SELECT COUNT(a.ParentId) AS AnswerCount, SUM(q.ViewCount) FROM Posts AS a JOIN Posts AS q ON a.ParentId = q.Id WHERE a.PostTypeId = 2 AND a.CreationDate >= '##StartDate##' AND a.CreationDate <= '##EndDate##' AND a.DeletionDate IS NULL AND a.OwnerUserId = '##UserId##'
|
### Instruction:
list airports in ARIZONA NEVADA and CALIFORNIA please
### Response:
|
SELECT DISTINCT airport_code FROM airport WHERE state_code IN (SELECT STATEalias0.state_code FROM state AS STATEalias0 WHERE ((STATEalias0.state_name = 'CALIFORNIA' OR STATEalias0.state_name = 'NEVADA') OR STATEalias0.state_name = 'ARIZONA'))
|
### Instruction:
how many patients whose days of hospital stay is greater than 14 and diagnoses long title is neonatal jaundice associated with preterm delivery?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "14" AND diagnoses.long_title = "Neonatal jaundice associated with preterm delivery"
|
### Instruction:
Show the names of phones that have total number of stocks bigger than 2000, in descending order of the total number of stocks.
### Response:
|
SELECT T2.Name FROM phone_market AS T1 JOIN phone AS T2 ON T1.Phone_ID = T2.Phone_ID GROUP BY T2.Name HAVING SUM(T1.Num_of_stock) >= 2000 ORDER BY SUM(T1.Num_of_stock) DESC
|
### Instruction:
Which CO 2 has an Output of ps (kw; hp) @4000 rpm, and a 0 100km/h, s smaller than 11.1?
### Response:
|
SELECT "CO 2" FROM table_60127 WHERE "Output" = 'ps (kw; hp) @4000 rpm' AND "0\u2013100km/h,s" < '11.1'
|
### Instruction:
count the number of patients who were given a stool microbiology test since 5 years ago.
### Response:
|
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT microlab.patientunitstayid FROM microlab WHERE microlab.culturesite = 'stool' AND DATETIME(microlab.culturetakentime) >= DATETIME(CURRENT_TIME(), '-5 year'))
|
### Instruction:
what is the score when the venue is stade g n ral seyni kountch , niamey, the competition is friendly and the date is 9 october 2012?
### Response:
|
SELECT "Score" FROM table_62921 WHERE "Venue" = 'stade général seyni kountché, niamey' AND "Competition" = 'friendly' AND "Date" = '9 october 2012'
|
### Instruction:
how many patients whose diagnoses short title is subendo infarct, initial and lab test abnormal status is abnormal?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Subendo infarct, initial" AND lab.flag = "abnormal"
|
### Instruction:
find the number of actors from Iran who played in ' Jim Jarmusch ' movies
### Response:
|
SELECT COUNT(DISTINCT (actor.name)) FROM actor, cast, directed_by, director, movie WHERE actor.nationality = 'Iran' AND cast.aid = actor.aid AND director.did = directed_by.did AND director.name = 'Jim Jarmusch' AND movie.mid = cast.msid AND movie.mid = directed_by.msid
|
### Instruction:
provide the number of medicaid insurance patients who had endoscopic excision or destruction of lesion or tissue of stomach.
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Medicaid" AND procedures.long_title = "Endoscopic excision or destruction of lesion or tissue of stomach"
|
### Instruction:
when was the last time that patient 1902 was prescribed a medication via iv during the current hospital visit?
### Response:
|
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1902 AND admissions.dischtime IS NULL) AND prescriptions.route = 'iv' ORDER BY prescriptions.startdate DESC LIMIT 1
|
### Instruction:
how many times has since 6 years ago patient 51200 visited the icu?
### Response:
|
SELECT COUNT(DISTINCT icustays.icustay_id) FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 51200) AND DATETIME(icustays.intime) >= DATETIME(CURRENT_TIME(), '-6 year')
|
### Instruction:
User List: Views per Rep. What makes these users so interesting?
### Response:
|
SELECT ROW_NUMBER() OVER (ORDER BY Views DESC) AS Rank, Id AS "user_link", Views, Reputation, ROUND(1.0 * Views / Reputation, 2) AS "viewsperrep" FROM Users WHERE Reputation >= '##MinimumReputation:int?200##' ORDER BY ViewsPerRep DESC, Views DESC LIMIT 100
|
### Instruction:
How many students are in each department? Show me a bar chart, sort by the y-axis from low to high.
### Response:
|
SELECT T1.dept_name, COUNT(DISTINCT T2.ID) FROM department AS T1 JOIN student AS T2 ON T1.dept_name = T2.dept_name JOIN instructor AS T3 ON T1.dept_name = T3.dept_name ORDER BY COUNT(DISTINCT T2.ID)
|
### Instruction:
give me the number of patients whose primary disease is sigmoid diverticulitis, colovestical fistula/sda and days of hospital stay is greater than 20?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "SIGMOID DIVERTICULITIS, COLOVESTICAL FISTULA/SDA" AND demographic.days_stay > "20"
|
### Instruction:
Users with the highest posts to total rep ratio.
### Response:
|
SELECT u.Id AS "user_link", u.Reputation, COUNT(*) AS "total_number_of_posts", COUNT(*) / u.Reputation AS Ratio FROM Users AS u JOIN Posts AS p ON p.OwnerUserId = u.Id WHERE p.PostTypeId IN (1, 2) GROUP BY u.Id, u.DisplayName, u.Reputation ORDER BY Ratio DESC LIMIT 100
|
### Instruction:
Average tag statistics with answers. Views, Score and Answers per Tag (with answers)
### Response:
|
WITH Questions AS (SELECT AVG(CAST(q.Score AS FLOAT)) AS score FROM Posts AS q INNER JOIN PostTags AS pt ON q.Id = pt.PostId INNER JOIN Tags AS t ON t.Id = pt.TagId WHERE q.PostTypeId = 1 AND t.TagName = '##tagname##') SELECT * FROM Questions AS q
|
### Instruction:
What is the maximum L3 cache of the processor whose speed is 2.00 GHZ, has a QPI speed of 4.8 gt/s, and is model e5504?
### Response:
|
SELECT MAX("L3 Cache (MB)") FROM table_3691 WHERE "QPI speed (GT/s)" = '4.8' AND "Speed (GHz)" = '2.00' AND "Model" = 'E5504'
|
### Instruction:
For those employees who was hired before 2002-06-21, visualize a bar chart about the distribution of hire_date and the sum of department_id bin hire_date by time, and order sum department id in ascending order.
### Response:
|
SELECT HIRE_DATE, SUM(DEPARTMENT_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY SUM(DEPARTMENT_ID)
|
### Instruction:
For all employees who have the letters D or S in their first name, give me the comparison about the average of manager_id over the hire_date bin hire_date by weekday by a bar chart, and show by the y axis in ascending.
### Response:
|
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY AVG(MANAGER_ID)
|
### Instruction:
What are the names of technicians with the machine series that they repair? Show me how many machines for each technician's name, show Y-axis from high to low order.
### Response:
|
SELECT Name, COUNT(Name) FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.Machine_ID = T2.Machine_ID JOIN technician AS T3 ON T1.technician_id = T3.technician_id GROUP BY Name ORDER BY COUNT(Name) DESC
|
### Instruction:
give me the number of patients whose year of death is less than or equal to 2183 and diagnoses icd9 code is 2984?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dod_year <= "2183.0" AND diagnoses.icd9_code = "2984"
|
### Instruction:
retrieve the patient identifications who have been diagnosed with pituitary cushing syndrome until 1 year ago.
### Response:
|
SELECT patient.uniquepid FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'pituitary cushing syndrome' AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CURRENT_TIME(), '-1 year'))
|
### Instruction:
Who is the star of the program on Thursdays 22:00~22:54 2005-04-xx to 2005-06-xx?
### Response:
|
SELECT "Starring Actors" FROM table_73020 WHERE "Time Frame" = 'Thursdays 22:00~22:54 2005-04-xx to 2005-06-xx'
|
### Instruction:
how many hours have passed since patient 1561 was admitted into the intensive care unit?
### Response:
|
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', icustays.intime)) FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1561) AND icustays.outtime IS NULL
|
### Instruction:
Find the number of the category descriptions of the products whose descriptions include letter 't', could you order by the names in descending?
### Response:
|
SELECT product_category_description, COUNT(product_category_description) FROM Ref_Product_Categories AS T1 JOIN Products AS T2 ON T1.product_category_code = T2.product_category_code WHERE T2.product_description LIKE '%t%' GROUP BY product_category_description ORDER BY product_category_description DESC
|
### Instruction:
what was the top four most commonly prescribed drugs until 2 years ago?
### Response:
|
SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions WHERE DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-2 year') GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 <= 4
|
### Instruction:
how many hours have passed since patient 6170 was admitted in the intensive care unit?
### Response:
|
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', icustays.intime)) FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 6170) AND icustays.outtime IS NULL
|
### Instruction:
provide the number of patients whose diagnoses long title is candidiasis of mouth and lab test fluid is blood?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Candidiasis of mouth" AND lab.fluid = "Blood"
|
### Instruction:
provide me the top four most common diagnosis since 2101?
### Response:
|
SELECT t1.diagnosisname FROM (SELECT diagnosis.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnosis WHERE STRFTIME('%y', diagnosis.diagnosistime) >= '2101' GROUP BY diagnosis.diagnosisname) AS t1 WHERE t1.c1 <= 4
|
### Instruction:
what is the number of patients who stayed in the hospital for more than 34 days and have been prescribed the drug neo*po*mct oil?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "34" AND prescriptions.drug = "NEO*PO*MCT Oil"
|
### Instruction:
how many patients whose procedure long title is open and other right hemicolectomy and lab test fluid is pleural?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE procedures.long_title = "Open and other right hemicolectomy" AND lab.fluid = "Pleural"
|
### Instruction:
Who were the starting actors in the time frame of tuesday 22:00~22:54 8 april 2008 to 17 june 2008?
### Response:
|
SELECT starring_actors FROM table_18539834_2 WHERE time_frame = "Tuesday 22:00~22:54 8 April 2008 to 17 June 2008"
|
### Instruction:
what is the number of patients whose admission location is trsf within this facility and diagnoses icd9 code is v4365?
### Response:
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND diagnoses.icd9_code = "V4365"
|
### Instruction:
For those employees who was hired before 2002-06-21, draw a bar chart about the distribution of hire_date and the sum of manager_id bin hire_date by weekday, could you sort in asc by the total number?
### Response:
|
SELECT HIRE_DATE, SUM(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY SUM(MANAGER_ID)
|
### Instruction:
In 2010 what journal published an article about Trophic Cascade ?
### Response:
|
SELECT DISTINCT paper.journalid FROM keyphrase, paper, paperkeyphrase WHERE keyphrase.keyphrasename = 'Trophic Cascade' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid AND paper.year = 2010 GROUP BY paper.journalid
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.