instruction
stringlengths 53
549
| output
stringlengths 30
2.33k
|
---|---|
### Instruction:
For those employees who do not work in departments with managers that have ids between 100 and 200, a line chart shows the trend of commission_pct over hire_date .
### Response:
| SELECT HIRE_DATE, COMMISSION_PCT FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) |
### Instruction:
count the number of patients whose admission year is less than 2156 and diagnoses long title is personal history of tobacco use?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2156" AND diagnoses.long_title = "Personal history of tobacco use" |
### Instruction:
give the number of patients whose discharge location is left against medical advice and procedure short title is int insert dual-cham dev.
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "LEFT AGAINST MEDICAL ADVI" AND procedures.short_title = "Int insert dual-cham dev" |
### Instruction:
What is the Location with a Year larger than 2011, and a President with herman van rompuy (2nd term), and a Date of 28 29 june, and a Type with scheduled?
### Response:
| SELECT location FROM table_name_63 WHERE year > 2011 AND president = "herman van rompuy (2nd term)" AND date = "28–29 june" AND type = "scheduled" |
### Instruction:
how many patients whose marital status is divorced and procedure long title is small-to-small intestinal anastomosis?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "DIVORCED" AND procedures.long_title = "Small-to-small intestinal anastomosis" |
### Instruction:
how many of the patients belonging to american indian/alaska ethnic origin received additive therapy?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND prescriptions.drug_type = "ADDITIVE" |
### Instruction:
Find posts with a given user's comments.
### Response:
| SELECT c.Id AS "Comment ID", c.CreationDate AS "Comment Date", p.Id AS "Post ID", p.ParentId AS "Parent ID", pp.Title AS "Question Title" FROM Posts AS p JOIN Posts AS pp ON p.ParentId = pp.Id JOIN Comments AS c ON c.PostId = p.Id WHERE c.UserId = 206691 |
### Instruction:
calculate the duration of hospital stay of patient 010-20205's last hospital stay.
### Response:
| SELECT STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', patient.hospitaladmittime) FROM patient WHERE patient.uniquepid = '010-20205' AND NOT patient.hospitaladmittime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1 |
### Instruction:
provide the number of black/cape verdean ethnic background patients who have diagnoses icd9 code 7810.
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND diagnoses.icd9_code = "7810" |
### Instruction:
What is the average number of ties for the Detroit Lions team when they have fewer than 5 wins, fewer than 3 losses, and a win percentage of 0.800?
### Response:
| SELECT AVG("Ties") FROM table_54583 WHERE "Losses" < '3' AND "Wins" < '5' AND "Win Pct." = '0.800' AND "Team" = 'detroit lions' |
### Instruction:
what is the number of patients with chemistry lab test category who had thoracentesis procedure?
### 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 = "Thoracentesis" AND lab."CATEGORY" = "Chemistry" |
### Instruction:
give me the number of patients whose year of death is less than or equal to 2155 and procedure icd9 code is 3806?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2155.0" AND procedures.icd9_code = "3806" |
### Instruction:
what were the three most common drugs prescribed in 2103?
### Response:
| SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions WHERE STRFTIME('%y', prescriptions.startdate) = '2103' GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 <= 3 |
### Instruction:
provide the number of patients whose ethnicity is black/african american and lab test name is protein/creatinine ratio?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.ethnicity = "BLACK/AFRICAN AMERICAN" AND lab.label = "Protein/Creatinine Ratio" |
### Instruction:
During which stage was the Intergiro classification held by Miguel Indurain, the Points classification held by Mario Cipollini, and the Young rider classification held by Leonardo Sierra?
### Response:
| SELECT "Stage" FROM table_70239 WHERE "Intergiro classification" = 'miguel indurain' AND "Points classification" = 'mario cipollini' AND "Young rider classification" = 'leonardo sierra' |
### Instruction:
Find the names of the trains that do not pass any station located in London.
### Response:
| SELECT T2.name FROM train_station AS T1 JOIN train AS T2 ON T1.train_id = T2.train_id WHERE NOT T1.station_id IN (SELECT T4.station_id FROM train_station AS T3 JOIN station AS T4 ON T3.station_id = T4.station_id WHERE t4.location = "London") |
### Instruction:
For those records from the products and each product's manufacturer, give me the comparison about the sum of revenue over the headquarter , and group by attribute headquarter, I want to display by the y-axis in desc please.
### Response:
| SELECT Headquarter, SUM(Revenue) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter ORDER BY SUM(Revenue) DESC |
### Instruction:
For dates had a minimum dew point smaller than any day in zip code 94107, show the total number of such days for each year using a bar chart, list from low to high by the y axis.
### Response:
| SELECT date, COUNT(date) FROM weather WHERE min_dew_point_f < (SELECT MIN(min_dew_point_f) FROM weather WHERE zip_code = 94107) ORDER BY COUNT(date) |
### Instruction:
What championship tournament did Ronald Vink play in with maikel scheffers as his partner in 2007 against stephane houdet nicolas peiffer?
### Response:
| SELECT "Championship" FROM table_60165 WHERE "Partnering" = 'maikel scheffers' AND "Year" > '2007' AND "Opponents in Final" = 'stephane houdet nicolas peiffer' |
### Instruction:
For those records from the products and each product's manufacturer, show me about the distribution of headquarter and the sum of revenue , and group by attribute headquarter in a bar chart, and rank total number from low to high order.
### Response:
| SELECT Headquarter, SUM(Revenue) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter ORDER BY SUM(Revenue) |
### Instruction:
what was the top five of the most frequent procedures since 2103?
### Response:
| SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment WHERE STRFTIME('%y', treatment.treatmenttime) >= '2103' GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 <= 5 |
### Instruction:
Days with at least one post by MathOverflow moderators.
### Response:
| SELECT DATE(p.CreationDate) FROM Users AS u INNER JOIN Posts AS p ON p.OwnerUserId = u.Id WHERE u.Id IN (2, 3, 66, 121, 1409, 2000, 2926) GROUP BY DATE(p.CreationDate) ORDER BY DATE(p.CreationDate) DESC |
### Instruction:
Questions tagged only [VBA] that should have [Excel] & [Excel-VBA] tags too!.
### Response:
| SELECT Id AS "post_link", CreationDate, LastActivityDate, Score, ViewCount, Tags, Body FROM Posts AS p WHERE Tags = '<vba>' AND UPPER(Body) LIKE '%EXCEL%' AND DeletionDate IS NULL AND ClosedDate IS NULL AND PostTypeId = 1 ORDER BY CreationDate DESC |
### Instruction:
What is the highest swimsuit score of the contestant with a higher than 9.55 interview score, and evening gown of 9.75, and an average higher than 9.67?
### Response:
| SELECT MAX("Swimsuit") FROM table_55523 WHERE "Interview" > '9.55' AND "Evening Gown" = '9.75' AND "Average" > '9.67' |
### Instruction:
hypoglycemia unawareness _ judged by history of blood sugars < 54 on glucometer without symptoms and / or hypoglycemic episodes requiring assistance from either family
### Response:
| SELECT * FROM table_train_241 WHERE hypoglycemia = 1 OR (blood_sugars < 54 AND glucometer = 1 AND symptoms_hypoglycemic_episodes = 0) |
### Instruction:
what is the top four procedure that is most common until 2100?
### Response:
| SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment WHERE STRFTIME('%y', treatment.treatmenttime) <= '2100' GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 <= 4 |
### Instruction:
calculate the number of visits to patient 015-12842's hospital in the last year.
### Response:
| SELECT COUNT(DISTINCT patient.patienthealthsystemstayid) FROM patient WHERE patient.uniquepid = '015-12842' AND DATETIME(patient.hospitaladmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') |
### Instruction:
what is the number of patients whose admission location is clinic referral/premature and procedure icd9 code is 46?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND procedures.icd9_code = "46" |
### Instruction:
What is the total number of goals that Malaysia scored where they played more than 1 game, had more than 1 draw, lost fewer than 19 games, and had more than 3 goals scored against them?
### Response:
| SELECT COUNT("Goals for") FROM table_11596 WHERE "Games played" > '1' AND "Drawn*" > '1' AND "Lost" < '19' AND "Goals against" > '3' |
### Instruction:
All questions with Bounty with tag android.
### Response:
| SELECT Posts.CreationDate, Posts.Id, Votes.BountyAmount, Posts.Title, Posts.AcceptedAnswerId, Posts.Tags FROM Posts LEFT JOIN Votes ON Votes.PostId = Posts.Id WHERE Posts.Tags LIKE ('%##Tag##%') AND BountyAmount > 0 ORDER BY Posts.CreationDate DESC LIMIT 30 |
### Instruction:
provide the number of patients whose year of birth is less than 1821 and lab test name is lactate dehydrogenase, csf?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "1821" AND lab.label = "Lactate Dehydrogenase, CSF" |
### Instruction:
What is the modified speed (6th gear) when standard torque (lb/ft) is 10.3 and modified torque (lb/ft) is 8.75?
### Response:
| SELECT modified_speed__6th_gear_ FROM table_19704392_1 WHERE standard_torque__lb_ft_ = "10.3" AND modified_torque__lb_ft_ = "8.75" |
### Instruction:
count the number of patients whose year of birth is less than 2112 and procedure short title is oth periton adhesiolysis?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dob_year < "2112" AND procedures.short_title = "Oth periton adhesiolysis" |
### Instruction:
How many Hispanic or Latino or Puerto Rican patients were given the drug named syringe
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND prescriptions.drug = "Syringe" |
### Instruction:
what were the four medicines most frequently prescribed until 2101?
### Response:
| SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions WHERE STRFTIME('%y', prescriptions.startdate) <= '2101' GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 <= 4 |
### Instruction:
give me the number of patients whose year of birth is less than 2089 and lab test fluid is cerebrospinal fluid (csf)?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2089" AND lab.fluid = "Cerebrospinal Fluid (CSF)" |
### Instruction:
count the number of patients whose admission type is urgent and procedure long title is combined right and left heart cardiac catheterization?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "URGENT" AND procedures.long_title = "Combined right and left heart cardiac catheterization" |
### Instruction:
For those records from the products and each product's manufacturer, give me the comparison about the sum of revenue over the name , and group by attribute name by a bar chart, and rank by the Y-axis in desc.
### Response:
| SELECT T2.Name, T2.Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T2.Revenue DESC |
### Instruction:
how many patients admitted in emergency were diagnosed with automatic implantable cardiac defibrillator in situ?
### 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 = "Automatic implantable cardiac defibrillator in situ" |
### Instruction:
Find the number of customers that use email as the contact channel for each weekday Visualize with a bar chart, list in descending by the y axis.
### Response:
| SELECT active_from_date, COUNT(active_from_date) FROM Customers AS t1 JOIN Customer_Contact_Channels AS t2 ON t1.customer_id = t2.customer_id WHERE t2.channel_code = 'Email' ORDER BY COUNT(active_from_date) DESC |
### Instruction:
how many times during their current hospital visit has patient 006-14121 visited the intensive care unit?
### Response:
| SELECT COUNT(DISTINCT patient.patientunitstayid) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-14121' AND patient.hospitaldischargetime IS NULL) |
### Instruction:
Find the titles of items that received both a rating higher than 8 and a rating below 5.
### Response:
| SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating > 8 INTERSECT SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating < 5 |
### Instruction:
Find the number of students who are older than 18 and do not have allergy to either food or animal.
### Response:
| SELECT COUNT(*) FROM Student WHERE age > 18 AND NOT StuID IN (SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "food" OR T2.allergytype = "animal") |
### Instruction:
Can my MDE class be MACROMOL 790 ?
### Response:
| SELECT COUNT(*) > 0 FROM course, program, program_course WHERE course.department = 'MACROMOL' AND course.number = 790 AND program_course.category LIKE '%MDE%' AND program_course.course_id = course.course_id AND program.name LIKE '%CS-LSA%' AND program.program_id = program_course.program_id |
### Instruction:
give me the number of patients whose age is less than 80 and diagnoses short title is hx-ven thrombosis/embols?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "80" AND diagnoses.short_title = "Hx-ven thrombosis/embols" |
### Instruction:
Questions per Day - Rolling average.
### Response:
| SELECT DATEFROMPARTS(YEAR(CreationDate), MONTH(CreationDate), DAY(CreationDate)) AS "date", COUNT(*) FROM Posts WHERE ParentId IS NULL GROUP BY YEAR(CreationDate), MONTH(CreationDate), DAY(CreationDate) ORDER BY YEAR(CreationDate), MONTH(CreationDate), DAY(CreationDate) |
### Instruction:
where is a good french restaurant in the yosemite and mono lake area ?
### Response:
| SELECT location.house_number, restaurant.name FROM geographic, location, restaurant WHERE geographic.region = 'yosemite and mono lake area' AND restaurant.city_name = geographic.city_name AND restaurant.food_type = 'french' AND restaurant.id = location.restaurant_id AND restaurant.rating > 2.5 |
### Instruction:
How many instructors are in each department? Show me a bar chart, sort by the x axis in asc.
### Response:
| SELECT T1.dept_name, COUNT(DISTINCT T3.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 T1.dept_name |
### Instruction:
provide the number of patients whose year of death is less than or equal to 2133 and procedure icd9 code is 3950?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2133.0" AND procedures.icd9_code = "3950" |
### Instruction:
calculate the total number of female patients who had endovascular (total) embolization or occlusion of head and neck vessels
### 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 = "Endovascular (total) embolization or occlusion of head and neck vessels" |
### Instruction:
For the club Minija Kretinga, what's the lowest number of wins with points smaller than 25, goals at 22 and goals conceded below 39?
### Response:
| SELECT MIN("Wins") FROM table_59273 WHERE "Points" < '25' AND "Goals scored" = '22' AND "Club" = 'minija kretinga' AND "Goals conceded" < '39' |
### Instruction:
For those records from the products and each product's manufacturer, find name and the average of manufacturer , and group by attribute name, and visualize them by a bar chart, sort mean manufacturer in ascending order.
### Response:
| SELECT T2.Name, T1.Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T1.Manufacturer |
### Instruction:
how many patients were staying in csru careunits a year before?
### Response:
| SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT transfers.hadm_id FROM transfers WHERE transfers.careunit = 'csru' AND DATETIME(transfers.intime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) |
### Instruction:
For those records from the products and each product's manufacturer, draw a bar chart about the distribution of name and code , and group by attribute name, I want to order by the X-axis in descending.
### Response:
| SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name, T1.Name ORDER BY T1.Name DESC |
### Instruction:
how many registed students do each course have? List course name and the number of their registered students?, sort X in asc order.
### Response:
| SELECT course_name, COUNT(*) FROM Students AS T1 JOIN Student_Course_Registrations AS T2 ON T1.student_id = T2.student_id JOIN Courses AS T3 ON T2.course_id = T3.course_id GROUP BY T2.course_id ORDER BY course_name |
### Instruction:
Users per nr of questions on M&TV.
### Response:
| WITH posts_per_user AS (SELECT COUNT(*) AS posts, p.OwnerUserId, p.PostTypeId FROM Posts AS p WHERE p.PostTypeId IN (1, 2) GROUP BY p.OwnerUserId, p.PostTypeId) SELECT COUNT(*) AS users, posts FROM posts_per_user AS ppu WHERE ppu.PostTypeId = 1 GROUP BY ppu.posts |
### Instruction:
count the number of patients whose admission type is elective and diagnoses long title is other staphylococcus pneumonia?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND diagnoses.long_title = "Other Staphylococcus pneumonia" |
### Instruction:
provide the number of patients whose ethnicity is black/haitian and diagnoses icd9 code is v4511?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "BLACK/HAITIAN" AND diagnoses.icd9_code = "V4511" |
### Instruction:
For those employees who was hired before 2002-06-21, give me the comparison about the sum of salary over the hire_date bin hire_date by time by a bar chart, and show by the Y in ascending.
### Response:
| SELECT HIRE_DATE, SUM(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY SUM(SALARY) |
### Instruction:
contraindication for nmr ( creatinin clearance < 30 ml / min / 1.73 m2, metallic implants or claustrophobia ) .
### Response:
| SELECT * FROM table_test_3 WHERE contraindication_for_nmr = 1 OR (creatinine_clearance_cl < 30 OR metallic_implants = 1 OR claustrophobia = 1) |
### Instruction:
provide the number of patients whose year of birth is less than 2098 and drug code is syringens?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "2098" AND prescriptions.formulary_drug_cd = "SYRINGENS" |
### Instruction:
Provide the number of patients who were admitted before the year 2146 and had procedure short title as cardiopulm resuscita nos.
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2146" AND procedures.short_title = "Cardiopulm resuscita NOS" |
### Instruction:
Which 300 -level courses are easy ?
### Response:
| SELECT DISTINCT course.name, course.number, program_course.workload FROM course, program_course WHERE course.department = 'EECS' AND course.number BETWEEN 300 AND 300 + 100 AND program_course.course_id = course.course_id AND program_course.workload < 3 ORDER BY program_course.workload |
### Instruction:
Name the Time of broadcast has a Picture format of 4:3, and Hours of 20:30, and Days of the week of monday, wednesday, friday?
### Response:
| SELECT "Time of broadcast" FROM table_45923 WHERE "Picture format" = '4:3' AND "Hours" = '20:30' AND "Days of the week" = 'monday, wednesday, friday' |
### Instruction:
What were the dates administered when the lead margin was smaller than 39 with Republican Christopher Reed at 37% and Democrat Tom Harkin at 53%?
### Response:
| SELECT "Dates administered" FROM table_45521 WHERE "Lead Margin" < '39' AND "Republican: Christopher Reed" = '37%' AND "Democrat: Tom Harkin" = '53%' |
### Instruction:
what number of patients admitted to the emergency room have been diagnosed under icd9 code 52809?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND diagnoses.icd9_code = "52809" |
### Instruction:
For those employees who do not work in departments with managers that have ids between 100 and 200, visualize a bar chart about the distribution of job_id and commission_pct .
### Response:
| SELECT JOB_ID, COMMISSION_PCT FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) |
### Instruction:
What are the invoice dates for customers with the first name Astrid and the last name Gruber, and count them by a bar chart, display by the Y in desc.
### Response:
| SELECT InvoiceDate, COUNT(InvoiceDate) FROM Customer AS T1 JOIN Invoice AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.FirstName = "Astrid" AND LastName = "Gruber" ORDER BY COUNT(InvoiceDate) DESC |
### Instruction:
has patient 002-17348 received an pt test?
### Response:
| SELECT COUNT(*) > 0 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-17348')) AND lab.labname = 'pt' |
### Instruction:
Which 2005 06 Pts has a Team of estudiantes (lp), and a 2006 07 Pts smaller than 81?
### Response:
| SELECT COUNT("2005\u201306 Pts") FROM table_13020 WHERE "Team" = 'estudiantes (lp)' AND "2006\u201307 Pts" < '81' |
### Instruction:
How many different percentages of immigrants are there for the year of 2007 in the countries with 1.2% of the immigrants in the year of 2005?
### Response:
| SELECT COUNT(_percentage_of_all_immigrants_2007) FROM table_23619212_1 WHERE _percentage_of_all_immigrants_2005 = "1.2%" |
### Instruction:
What is the total Design flow (LPM) with a Partner of app, a Construction Start of 2008 january, and a Population Served larger than 3500?
### Response:
| SELECT SUM("Design flow (LPM)") FROM table_61605 WHERE "Partner" = 'app' AND "Construction Start" = '2008 january' AND "Population Served" > '3500' |
### Instruction:
provide the number of patients whose admission type is urgent and procedure long title is arteriography of cerebral arteries.
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "URGENT" AND procedures.long_title = "Arteriography of cerebral arteries" |
### Instruction:
Count the number of patients who died in or before year 2112 and used the drug named dextrose 50%
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dod_year <= "2112.0" AND prescriptions.drug = "Dextrose 50%" |
### Instruction:
what was the length of stay in patient 013-17922's first hospital stay?
### Response:
| SELECT STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', patient.hospitaladmittime) FROM patient WHERE patient.uniquepid = '013-17922' AND NOT patient.hospitaladmittime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1 |
### Instruction:
What is the total average for the England team when the wickets are less than 18, the best bowling is 4/138, and there are less than 3 matches?
### Response:
| SELECT COUNT("Average") FROM table_49940 WHERE "Team" = 'england' AND "Wickets" < '18' AND "Best Bowling" = '4/138' AND "Matches" < '3' |
### Instruction:
For all employees who have the letters D or S in their first name, return a bar chart about the distribution of job_id and the average of salary , and group by attribute job_id, show y-axis in asc order.
### Response:
| SELECT JOB_ID, AVG(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY AVG(SALARY) |
### Instruction:
What is the highest OWGR pts, whenn Winner is Lin Wen-Tang (4), and when Prize fund ( US$ ) is less than 2,250,000?
### Response:
| SELECT MAX("OWGR pts") FROM table_7625 WHERE "Winner" = 'lin wen-tang (4)' AND "Prize fund ( US$ )" < '2,250,000' |
### Instruction:
what keyphrases get most citations ?
### Response:
| SELECT DISTINCT COUNT(cite.citingpaperid), keyphrase.keyphrasename FROM cite, keyphrase, paperkeyphrase WHERE paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paperkeyphrase.paperid = cite.citedpaperid GROUP BY keyphrase.keyphrasename ORDER BY COUNT(cite.citingpaperid) DESC |
### Instruction:
What is the number of electorates (2009) for the Indore district, when reserved for (SC / ST /None) is none, and constituency number is 208?
### Response:
| SELECT SUM(number_of_electorates__2009_) FROM table_name_21 WHERE district = "indore" AND reserved_for___sc___st__none_ = "none" AND constituency_number = "208" |
### Instruction:
For those records from the products and each product's manufacturer, give me the comparison about the average of price over the headquarter , and group by attribute headquarter by a bar chart, and list by the x axis in descending please.
### Response:
| SELECT Headquarter, AVG(Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter ORDER BY Headquarter DESC |
### 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 show by the Y from low to high.
### 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 T2.Revenue |
### Instruction:
What is the area (in km2) for the community that has a status of village, a census ranking of 2,471 of 5,008, and a population of less than 748?
### Response:
| SELECT SUM(area_km_2) FROM table_name_10 WHERE status = "village" AND census_ranking = "2,471 of 5,008" AND population < 748 |
### Instruction:
This is why the taxonomy sucks.
### Response:
| SELECT COUNT(DISTINCT UserId) AS "number_of_people_helping", PostHistoryTypeId, pht.Name FROM PostHistory INNER JOIN PostHistoryTypes AS pht ON PostHistoryTypeId = pht.Id WHERE PostHistoryTypeId > 3 AND PostHistoryTypeId < 7 GROUP BY PostHistoryTypeId, pht.Name ORDER BY 'number_of_people_helping' DESC |
### Instruction:
What is the reserved for (SC/ST/None) when number of electorates (2009) is larger than 101,595, and constituency is 49?
### Response:
| SELECT "Reserved for ( SC / ST /None)" FROM table_62680 WHERE "Number of electorates (2009)" > '101,595' AND "Constituency number" = '49' |
### Instruction:
What are the names of all the Japanese constructors that have earned more than 5 points, and count them by a bar chart, and list by the X-axis from low to high please.
### Response:
| SELECT name, COUNT(name) FROM constructors AS T1 JOIN constructorStandings AS T2 ON T1.constructorId = T2.constructorId WHERE T1.nationality = "Japanese" AND T2.points > 5 GROUP BY name ORDER BY name |
### Instruction:
COunt the EBIT (US $m) which has a Revenue (US $million) larger than 434.8 and a Net profit (US $m) larger than 96.4?
### Response:
| SELECT COUNT(ebit__us_) AS $m_ FROM table_name_35 WHERE revenue__us_$million_ > 434.8 AND net_profit__us_$m_ > 96.4 |
### Instruction:
when did patient 65582 get in the first hospital encounter a lab test for the first time?
### Response:
| SELECT labevents.charttime FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 65582 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) ORDER BY labevents.charttime LIMIT 1 |
### Instruction:
For any rating where the name of reviewer is the same as the director of the movie, return the reviewer name, movie title, and number of stars.
### Response:
| SELECT DISTINCT T3.name, T2.title, T1.stars FROM rating AS T1 JOIN movie AS T2 ON T1.mid = T2.mid JOIN reviewer AS T3 ON T1.rid = T3.rid WHERE T2.director = T3.name |
### Instruction:
List lesson id of all lessons taught by staff with first name as Janessa, last name as Sawayn and nickname containing letter 's'.
### Response:
| SELECT T1.lesson_id FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn" AND nickname LIKE "%s%" |
### Instruction:
For those records from the products and each product's manufacturer, visualize a bar chart about the distribution of name and code , and group by attribute headquarter, and list in ascending by the Y-axis.
### Response:
| SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter, T1.Name ORDER BY T1.Code |
### Instruction:
how much larger was the 2009 population of chicago than the 2009 population of toronto ?
### Response:
| SELECT (SELECT "csa/cma\n2009 population" FROM table_204_113 WHERE "area" = 'chicago') - (SELECT "csa/cma\n2009 population" FROM table_204_113 WHERE "area" = 'toronto') |
### Instruction:
provide the number of patients whose gender is m and diagnoses long title is poisoning by other opiates and related narcotics?
### 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 = "Poisoning by other opiates and related narcotics" |
### Instruction:
In 2014, what are the id and rank of the team that has the largest average number of attendance?
### Response:
| SELECT T2.team_id, T2.rank FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id WHERE T1.year = 2014 GROUP BY T1.team_id ORDER BY AVG(T1.attendance) DESC LIMIT 1 |
### Instruction:
What is the 1978 Veteran membership with a late 1941 macedonia and a late 1943 less than 10,000?
### Response:
| SELECT SUM(1978 AS _veteran_membership) FROM table_name_66 WHERE NOT _late_1941 = "macedonia" AND late_1943 < 10 OFFSET 000 |
### Instruction:
what is the number of patients whose year of birth is less than 1850 and diagnoses short title is nutritional marasmus?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dob_year < "1850" AND diagnoses.short_title = "Nutritional marasmus" |
### Instruction:
count the number of patients whose religion is greek orthodox and diagnoses long title is drug-induced delirium?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.religion = "GREEK ORTHODOX" AND diagnoses.long_title = "Drug-induced delirium" |
### Instruction:
how many patients on additive type drug prescription had sodium lab test done?
### 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.drug_type = "ADDITIVE" AND lab.label = "Sodium" |
### Instruction:
For those employees who do not work in departments with managers that have ids between 100 and 200, find phone_number and department_id , and visualize them by a bar chart.
### Response:
| SELECT PHONE_NUMBER, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) |
### Instruction:
For those records from the products and each product's manufacturer, show me about the distribution of name and the sum of price , and group by attribute name in a bar chart, and could you order from low to high by the y axis?
### Response:
| SELECT T2.Name, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T1.Price |
Subsets and Splits