instruction
stringlengths 53
549
| output
stringlengths 30
2.33k
|
---|---|
### Instruction:
Which Big (>500ha) has a Micro (10ha) larger than 940, and a Department of potos , and a Total smaller than 16,240?
### Response:
| SELECT MAX(big__) > 500 AS ha_ FROM table_name_12 WHERE micro__10ha_ > 940 AND department = "potosí" AND total < 16 OFFSET 240 |
### Instruction:
For those records from the products and each product's manufacturer, show me about the distribution of name and the average of price , and group by attribute name in a bar chart, and could you display from high to low by the Name?
### Response:
| SELECT T1.Name, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Name DESC |
### Instruction:
just count how many patients have been prescribed spironolactone in 2105.
### Response:
| SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT prescriptions.hadm_id FROM prescriptions WHERE prescriptions.drug = 'spironolactone' AND STRFTIME('%y', prescriptions.startdate) = '2105') |
### Instruction:
Number of active users with >= 1 post in last 30 days. Enter Query Description
### Response:
| SELECT COUNT(*) FROM Users WHERE Reputation > 500 AND DATEDIFF(day, LastAccessDate, GETDATE()) > 365 /* (SELECT Count(*) FROM Posts WHERE (Posts.OwnerUserId = Users.Id) AND (DATEDIFF(day, CreationDate, GETDATE()) < 365) ) > 1 */ |
### Instruction:
How many different values of total power are there for the unit whose construction started on 01.03.1977 and whose commercial operation started on 01.02.1984?
### Response:
| SELECT COUNT("Total power") FROM table_17901 WHERE "Construction start" = '01.03.1977' AND "Commercial operation" = '01.02.1984' |
### Instruction:
provide the number of patients whose days of hospital stay is greater than 43 and procedure short title is aortocor bypas-2 cor art?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "43" AND procedures.short_title = "Aortocor bypas-2 cor art" |
### Instruction:
EPID 788 has how many sections ?
### Response:
| SELECT COUNT(*) FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EPID' AND course.number = 788 AND semester.semester = 'WN' AND semester.semester_id = course_offering.semester AND semester.year = 2016 |
### Instruction:
give me the number of patients whose admission year is less than 2180 and diagnoses long title is other alteration of consciousness?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2180" AND diagnoses.long_title = "Other alteration of consciousness" |
### Instruction:
A bar chart listing the number of faults for different description of skills required to fix them.
### Response:
| SELECT skill_description, COUNT(skill_description) FROM Part_Faults AS T1 JOIN Skills_Required_To_Fix AS T2 ON T1.part_fault_id = T2.part_fault_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id GROUP BY skill_description |
### Instruction:
What is the population of the place that has an area (km ) of 30,528, and a GDP (billion US$) larger than 58.316?
### Response:
| SELECT SUM("Population") FROM table_67870 WHERE "Area (km\u00b2)" = '30,528' AND "GDP (billion US$)" > '58.316' |
### Instruction:
For those records from the products and each product's manufacturer, draw a bar chart about the distribution of name and the sum of revenue , and group by attribute name, list from high to low by the Y-axis.
### Response:
| SELECT T1.Name, T2.Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T2.Revenue DESC |
### Instruction:
Give the names, details, and data types of characteristics that are not found in any product.
### Response:
| SELECT characteristic_name, other_characteristic_details, characteristic_data_type FROM characteristics EXCEPT SELECT t1.characteristic_name, t1.other_characteristic_details, t1.characteristic_data_type FROM characteristics AS t1 JOIN product_characteristics AS t2 ON t1.characteristic_id = t2.characteristic_id |
### Instruction:
give the number of patients whose admission type is newborn and diagnosis long title is intestinovesical fistula.
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "NEWBORN" AND diagnoses.long_title = "Intestinovesical fistula" |
### Instruction:
count the number of patients whose ethnicity is hispanic or latino 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.ethnicity = "HISPANIC OR LATINO" AND procedures.icd9_code = "3950" |
### Instruction:
For those records from the products and each product's manufacturer, visualize a bar chart about the distribution of name and the sum of revenue , and group by attribute name, could you list bars from high to low order please?
### 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.Name DESC |
### Instruction:
what is the number of patients whose admission year is less than 2151 and procedure short title is suture bladder lacerat?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2151" AND procedures.short_title = "Suture bladder lacerat" |
### Instruction:
What was the result(s) in the event 3 squatlift for the man from the United states with a result of 1 (42.66s) in the event 2 truck pull?
### Response:
| SELECT event_3_squat_lift FROM table_24302700_2 WHERE nationality = "United States" AND event_2_truck_pull = "1 (42.66s)" |
### Instruction:
count the number of patients whose days of hospital stay is greater than 30 and diagnoses short title is chr diastolic hrt fail?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "30" AND diagnoses.short_title = "Chr diastolic hrt fail" |
### Instruction:
in 2105, how many patients were prescribed with ondansetron hcl?
### Response:
| SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'ondansetron hcl' AND STRFTIME('%y', medication.drugstarttime) = '2105') |
### Instruction:
who was the sheriff in suffolk county before amza biggs first term there as sheriff ?
### Response:
| SELECT "sheriff" FROM table_203_321 WHERE "start of term" < (SELECT "start of term" FROM table_203_321 WHERE "sheriff" = 'amza biggs' ORDER BY "start of term" LIMIT 1) ORDER BY "start of term" DESC LIMIT 1 |
### Instruction:
For all the claims whose claimed amount is larger than the average, bin the claim date into day of week interval and count them for visualizing a bar chart, order from high to low by the y axis.
### Response:
| SELECT Date_Claim_Made, COUNT(Date_Claim_Made) FROM Claims WHERE Amount_Claimed > (SELECT AVG(Amount_Claimed) FROM Claims) ORDER BY COUNT(Date_Claim_Made) DESC |
### Instruction:
count the number of patients whose admission year is less than 2198 and diagnoses icd9 code is 7830?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2198" AND diagnoses.icd9_code = "7830" |
### Instruction:
What number of sections are there for PHYSED 425 ?
### Response:
| SELECT COUNT(DISTINCT course_offering.section_number) FROM course INNER JOIN program_course ON program_course.course_id = course.course_id INNER JOIN course_offering ON course.course_id = course_offering.course_id WHERE course.department = 'PHYSED' AND course.number = 425 |
### Instruction:
what is the number of patients whose discharge location is disch-tran to psych hosp and procedure short title is spinal tap?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "DISCH-TRAN TO PSYCH HOSP" AND procedures.short_title = "Spinal tap" |
### Instruction:
what is the difference in combined defenses between hiroshi tanahashi and kensuke sasaki ?
### Response:
| SELECT (SELECT "combined\ndefenses" FROM table_203_678 WHERE "wrestler" = 'hiroshi tanahashi') - (SELECT "combined\ndefenses" FROM table_203_678 WHERE "wrestler" = 'kensuke sasaki') |
### Instruction:
What's the white for a black of Anand, a result of , 39 moves, and an opening of d37 queen's gambit declined?
### Response:
| SELECT "White" FROM table_59931 WHERE "Black" = 'anand' AND "Result" = '½–½' AND "Moves" = '39' AND "Opening" = 'd37 queen''s gambit declined' |
### Instruction:
For those records from the products and each product's manufacturer, find name and the sum of code , and group by attribute name, and visualize them by a bar chart, and show total number of code from high to low order.
### Response:
| SELECT T2.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T1.Code DESC |
### Instruction:
provide the number of patients with abnormal lab test status who have diagnoses of other chronic pain.
### 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 = "Other chronic pain" AND lab.flag = "abnormal" |
### 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:
For those records from the products and each product's manufacturer, show me about the distribution of name and code , and group by attribute founder in a bar chart, and order from high to low 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 Founder, T1.Name ORDER BY T1.Code DESC |
### Instruction:
What is the highest 2003 value with a 1990 greater than 74, a 125 value in 1985, and a 1995 value greater than 130?
### Response:
| SELECT MAX(2003) FROM table_name_84 WHERE 1990 > 74 AND 1985 = 125 AND 1995 > 130 |
### Instruction:
what is the number of patients whose marital status is married and diagnoses short title is hx of gi malignancy nos?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "MARRIED" AND diagnoses.short_title = "Hx of GI malignancy NOS" |
### Instruction:
For each branch id, what are the names of the branches that were registered after 2015 Visualize by bar chart, could you order the total number in asc order?
### Response:
| SELECT Name, COUNT(*) FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.Branch_ID = T2.Branch_ID WHERE T1.Register_Year > 2015 GROUP BY T2.Branch_ID ORDER BY COUNT(*) |
### Instruction:
What Miss Maja Pilipinas has a Binibining Pilipinas-Tourism of not awarded, and a Binibining Pilipinas-Universe of anjanette abayari?
### Response:
| SELECT miss_maja_pilipinas FROM table_name_30 WHERE binibining_pilipinas_tourism = "not awarded" AND binibining_pilipinas_universe = "anjanette abayari" |
### Instruction:
what was patient 19412's last careunit of the ward on the current hospital visit?
### Response:
| SELECT transfers.careunit FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 19412 AND admissions.dischtime IS NULL) AND NOT transfers.careunit IS NULL ORDER BY transfers.intime DESC LIMIT 1 |
### Instruction:
what is the total number of patients who remained admitted in hospital for more than 4 days and treated with sodium citrate 4%?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "4" AND prescriptions.drug = "Sodium CITRATE 4%" |
### Instruction:
What is the lowest score in the Highest score column when Master P was the Worst dancer(s), Drew Lachey was the Best dancer(s), and the Lowest score was under 8?
### Response:
| SELECT MIN(highest_score) FROM table_name_92 WHERE worst_dancer_s_ = "master p" AND best_dancer_s_ = "drew lachey" AND lowest_score < 8 |
### Instruction:
count the number of patients whose admission year is less than 2124 and diagnoses long title is other specified disorders of skin?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2124" AND diagnoses.long_title = "Other specified disorders of skin" |
### Instruction:
Off topic questions in after 2015-1-1.
### Response:
| SELECT p.Id FROM Posts AS p INNER JOIN PostHistory AS ph ON p.Id = ph.PostId WHERE p.PostTypeId = 1 AND p.ClosedDate = ph.CreationDate AND ph.PostHistoryTypeId = 10 AND (Comment = 102) AND p.ClosedDate > '2015-1-1' |
### Instruction:
how many patients whose year of death is less than or equal to 2126 and procedure icd9 code is 9229?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2126.0" AND procedures.icd9_code = "9229" |
### Instruction:
display those employees who contain a letter z to their first name and also display their last name, city.
### Response:
| SELECT T1.first_name, T1.last_name, T3.city FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id WHERE T1.first_name LIKE '%z%' |
### Instruction:
what is the number of patients whose age is less than 31 and diagnoses short title is crnry athrscl natve vssl?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "31" AND diagnoses.short_title = "Crnry athrscl natve vssl" |
### Instruction:
For those employees who do not work in departments with managers that have ids between 100 and 200, return a line chart about the change of department_id over hire_date .
### Response:
| SELECT HIRE_DATE, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) |
### Instruction:
how many patients have phys referral/normal deli as the admission location procedure icd9 code 309?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND procedures.icd9_code = "309" |
### Instruction:
What is the lowest To par, when Total is greater than 148, and when Year(s) Won is '1959 , 1968 , 1974'?
### Response:
| SELECT MIN("To par") FROM table_60893 WHERE "Total" < '148' AND "Year(s) won" = '1959 , 1968 , 1974' |
### Instruction:
For those records from the products and each product's manufacturer, give me the comparison about manufacturer over the name , and group by attribute founder, show from low to high by the Y-axis.
### Response:
| SELECT T1.Name, T1.Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder, T1.Name ORDER BY T1.Manufacturer |
### Instruction:
Show all branch names with the number of members in each branch registered after 2015 Plot them as bar chart, and sort in descending by the Y please.
### Response:
| SELECT Name, COUNT(*) FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.Branch_ID = T2.Branch_ID WHERE T1.Register_Year > 2015 GROUP BY T2.Branch_ID ORDER BY COUNT(*) DESC |
### Instruction:
Give the number of patients whose admission location is transfer from hosp/extram that had a procedure icd9 code of 40.
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND procedures.icd9_code = "40" |
### Instruction:
how many patients whose discharge location is rehab/distinct part hosp and procedure long title is other phototherapy?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "REHAB/DISTINCT PART HOSP" AND procedures.long_title = "Other phototherapy" |
### Instruction:
What are the entry names of catalog with the attribute possessed by most entries.
### Response:
| SELECT t1.catalog_entry_name FROM catalog_contents AS t1 JOIN catalog_contents_additional_attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.attribute_value = (SELECT attribute_value FROM catalog_contents_additional_attributes GROUP BY attribute_value ORDER BY COUNT(*) DESC LIMIT 1) |
### Instruction:
Calculate the number of patients admitted before the year 2144 who had cirrhosis of liver nos.
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2144" AND diagnoses.short_title = "Cirrhosis of liver NOS" |
### Instruction:
Distribution of my questions and answers by their score.
### Response:
| SELECT Posts.Score, COUNT(*) AS Number, (CASE WHEN MIN(Posts.PostTypeId) = 1 THEN 'Question' ELSE 'Answer' END) AS Type FROM Posts WHERE Posts.OwnerUserId = @UserId AND Posts.PostTypeId IN (1, 2) GROUP BY Posts.Score, Posts.PostTypeId ORDER BY Type, Score DESC |
### Instruction:
A line chart for what are the number of the order dates of orders with price higher than 1000?
### Response:
| SELECT Order_Date, COUNT(Order_Date) FROM Customer_Orders AS T1 JOIN Order_Items AS T2 ON T1.Order_ID = T2.Order_ID JOIN Products AS T3 ON T2.Product_ID = T3.Product_ID WHERE T3.Product_Price > 1000 |
### Instruction:
give me the number of patients whose admission year is less than 2176 and diagnoses short title is hypopotassemia?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2176" AND diagnoses.short_title = "Hypopotassemia" |
### Instruction:
Count the number of Annual Meeting events that took place in the region of the United Kingdom.
### Response:
| SELECT COUNT(*) FROM region AS t1 JOIN party AS t2 ON t1.region_id = t2.region_id JOIN party_events AS t3 ON t2.party_id = t3.party_id WHERE t1.region_name = "United Kingdom" AND t3.event_name = "Annaual Meeting" |
### Instruction:
report the number of patients admitted before 2177 who had left internal jugular vein thrombosis; left arm edema primary disease.
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "LEFT INTERNAL JUGULAR VEIN THROMBOSIS;LEFT ARM EDEMA" AND demographic.admityear < "2177" |
### Instruction:
Posts with many 'thank you' answers. Looking at posts shorter than 200 with the text `hank` somewhere in it
### Response:
| SELECT ParentId AS "post_link", COUNT(Id) FROM Posts WHERE PostTypeId = 2 AND LENGTH(Body) <= 200 AND (Body LIKE '%hey i%') GROUP BY ParentId HAVING COUNT(Id) > 1 ORDER BY COUNT(Id) DESC |
### Instruction:
What is the sample size of the poll taken on Dec 13-15, 2007 that had a margin of error of more than 4 and resulted with Republican Mike Huckabee?
### Response:
| SELECT AVG(sample_size) FROM table_name_5 WHERE republican = "mike huckabee" AND margin_of_error > 4 AND date = "dec 13-15, 2007" |
### Instruction:
Query users posts and answers after 2018.
### Response:
| SELECT A.Id, A.PostTypeId, A.Title, A.Body, A.ParentId, A.Tags, A.CreationDate FROM Posts AS A LEFT JOIN Users AS U ON A.OwnerUserId = U.Id WHERE U.Reputation > '##num##' AND A.PostTypeId = 1 AND A.CreationDate > 2018 |
### Instruction:
How many patients who had other percutaneous procedures on biliary tract died in or before the year 2148?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2148.0" AND procedures.long_title = "Other percutaneous procedures on biliary tract" |
### Instruction:
data sets for textual entailment
### Response:
| SELECT DISTINCT dataset.datasetid FROM dataset, keyphrase, paperdataset, paperkeyphrase WHERE keyphrase.keyphrasename = 'textual entailment' AND paperdataset.datasetid = dataset.datasetid AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paperkeyphrase.paperid = paperdataset.paperid |
### Instruction:
Give me a list of cities whose temperature in Mar is lower than that in Dec and which have never been host cities.
### Response:
| SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.mar < T2.dec EXCEPT SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city |
### Instruction:
Who is performing in the back stage position for the song 'Badlands'? Show the first name and the last name.
### Response:
| SELECT T2.firstname, T2.lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE T3.Title = "Badlands" AND T1.StagePosition = "back" |
### Instruction:
give me the number of patients whose days of hospital stay is greater than 3 and diagnoses short title is ac vasc insuff intestine?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "3" AND diagnoses.short_title = "Ac vasc insuff intestine" |
### Instruction:
For those records from the products and each product's manufacturer, return a bar chart about the distribution of name and the average of revenue , and group by attribute name, and I want to rank bars from low to high order.
### 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.Name |
### Instruction:
For those records from the products and each product's manufacturer, find name and code , and group by attribute name, and visualize them by a bar chart, and sort from low to high by the Code.
### 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.Code |
### Instruction:
For each course id, how many students are registered and what are the course names, sort by the Y in descending.
### 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 COUNT(*) DESC |
### Instruction:
give me the number of patients whose admission location is transfer from hosp/extram and lab test name is iron binding capacity, total?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND lab.label = "Iron Binding Capacity, Total" |
### Instruction:
how many patients iwere admitted before the year 2178 operated for continous intra-arterial blood gas monitoring?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2178" AND procedures.long_title = "Continuous intra-arterial blood gas monitoring" |
### Instruction:
show me the flights arriving at DAL from all other airports
### Response:
| SELECT DISTINCT flight.flight_id FROM airport, airport_service, city, flight WHERE airport.airport_code = 'DAL' AND city.city_code = airport_service.city_code AND flight.from_airport = airport_service.airport_code AND flight.to_airport = airport.airport_code |
### Instruction:
calculate the duration of patient 010-23252's last hospital stay.
### Response:
| SELECT STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', patient.hospitaladmittime) FROM patient WHERE patient.uniquepid = '010-23252' AND NOT patient.hospitaladmittime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1 |
### Instruction:
are there bi-tone is there's no olive drab and the caliber is 9 19mm parabellum and model is xdm 5.25 competition
### Response:
| SELECT bi_tone FROM table_2869843_1 WHERE olive_drab = "No" AND caliber = "9×19mm Parabellum" AND model = "XDM 5.25 Competition" |
### Instruction:
For those employees who do not work in departments with managers that have ids between 100 and 200, give me the comparison about commission_pct over the phone_number .
### Response:
| SELECT PHONE_NUMBER, COMMISSION_PCT FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) |
### Instruction:
Duplicates of the given post (with some information on question).
### Response:
| SELECT pl.PostId AS "post_link", p.Title, p.Score, p.ViewCount, p.AnswerCount, p.Tags FROM PostLinks AS pl INNER JOIN Posts AS p ON p.Id = pl.PostId WHERE (pl.RelatedPostId = '##id?30732##') AND (pl.LinkTypeId = 3) |
### Instruction:
give me a good restaurant in the bay area ?
### Response:
| SELECT location.house_number, restaurant.name FROM location, restaurant WHERE restaurant.city_name IN (SELECT GEOGRAPHICalias0.city_name FROM geographic AS GEOGRAPHICalias0 WHERE GEOGRAPHICalias0.region = 'bay area') AND restaurant.id = location.restaurant_id AND restaurant.rating > 2.5 |
### Instruction:
At which restaurant did the students spend the least amount of time? List restaurant and the time students spent on in total.
### Response:
| SELECT Restaurant.ResName, SUM(Visits_Restaurant.Spent) FROM Visits_Restaurant JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID GROUP BY Restaurant.ResID ORDER BY SUM(Visits_Restaurant.Spent) LIMIT 1 |
### Instruction:
What were the total games in the Big Ten conference when Nebraska lost fewer than 488 games and had a Pct less than 0.7014?
### Response:
| SELECT SUM("Total Games") FROM table_10674 WHERE "Conference" = 'big ten' AND "Lost" < '488' AND "Team" = 'nebraska' AND "Pct." < '0.7014' |
### Instruction:
For those records from the products and each product's manufacturer, a bar chart shows the distribution of name and the amount of name , and group by attribute name, and list from low to high by the Name please.
### Response:
| SELECT T1.Name, COUNT(T1.Name) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Name |
### Instruction:
give me the number of patients whose primary disease is left femur fracture and procedure icd9 code is 8848?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "LEFT FEMUR FRACTURE" AND procedures.icd9_code = "8848" |
### Instruction:
For all employees who have the letters D or S in their first name, give me the comparison about the sum of salary over the job_id , and group by attribute job_id, and order y-axis in asc order.
### Response:
| SELECT JOB_ID, SUM(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY SUM(SALARY) |
### Instruction:
For those records from the products and each product's manufacturer, give me the comparison about price over the name , and group by attribute headquarter by a bar chart, rank by the X in desc.
### Response:
| SELECT T1.Name, T1.Price 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 admission type is urgent and drug name is diphenhydramine hcl?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "URGENT" AND prescriptions.drug = "DiphenhydrAMINE HCl" |
### Instruction:
when was patient 75658 discharged from the hospital in the previous year for the first time?
### Response:
| SELECT admissions.dischtime FROM admissions WHERE admissions.subject_id = 75658 AND DATETIME(admissions.dischtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY admissions.dischtime LIMIT 1 |
### Instruction:
how many patients have had a other microbiology test since 2104?
### Response:
| SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT microlab.patientunitstayid FROM microlab WHERE microlab.culturesite = 'other' AND STRFTIME('%y', microlab.culturetakentime) >= '2104') |
### Instruction:
For those employees who do not work in departments with managers that have ids between 100 and 200, what is the relationship between employee_id and manager_id ?
### Response:
| SELECT EMPLOYEE_ID, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) |
### Instruction:
For those employees who do not work in departments with managers that have ids between 100 and 200, draw a bar chart about the distribution of first_name and department_id .
### Response:
| SELECT FIRST_NAME, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) |
### Instruction:
PHP questions waiting to be reviewed.
### Response:
| SELECT COUNT(1) FROM (SELECT Posts.Id FROM Votes JOIN Posts ON Votes.PostId = Posts.Id JOIN PostTags ON Posts.Id = PostTags.PostId JOIN Tags ON PostTags.TagId = Tags.Id WHERE Posts.ClosedDate IS NULL AND VoteTypeId = 6 AND TagName = 'php' GROUP BY Posts.Id) AS Foo |
### Instruction:
How many Goals have Games smaller than 6, and a Debut year of 1939, and Years at club of 1939, 1941?
### Response:
| SELECT COUNT("Goals") FROM table_14165 WHERE "Games" < '6' AND "Debut year" = '1939' AND "Years at club" = '1939, 1941' |
### Instruction:
how many patients of white ethnicity are diagnosed with primary disease sigmoid diverticulitis, colovestical fistula/sda?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "WHITE" AND demographic.diagnosis = "SIGMOID DIVERTICULITIS, COLOVESTICAL FISTULA/SDA" |
### Instruction:
during this year, patient 031-17228 visited an er?
### Response:
| SELECT COUNT(*) > 0 FROM patient WHERE patient.uniquepid = '031-17228' AND patient.hospitaladmitsource = 'emergency department' AND DATETIME(patient.unitadmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') |
### Instruction:
What percentage of the population is below 50% of the median income in the region where 10.4% of the population earns below 40% of the median income?
### Response:
| SELECT COUNT(below_50_percentage_of_median_income) FROM table_25042332_16 WHERE below_40_percentage_of_median_income = "10.4%" |
### Instruction:
What is the number of emergency hospital admitted patients who take sodium polystyrene sulfonate?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND prescriptions.drug = "Sodium Polystyrene Sulfonate" |
### Instruction:
What is the gdp per capita in 2008 for the region with a combined gross enrollment ratio of 86.6 in 2009?
### Response:
| SELECT MAX(gdp__ppp__per_capita__2008_) FROM table_25042332_33 WHERE combined_gross_enrollment_ratio__2009_ = "86.6" |
### Instruction:
Show the name and number of employees for the departments managed by heads whose temporary acting value is 'Yes' Visualize by bar chart, could you show in ascending by the names?
### Response:
| SELECT Name, AVG(Num_Employees) FROM department AS T1 JOIN management AS T2 ON T1.department_ID = T2.department_ID WHERE T2.temporary_acting = 'Yes' GROUP BY Name ORDER BY Name |
### Instruction:
give me the number of patients on levofloxacin who died in or before 2165.
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dod_year <= "2165.0" AND prescriptions.drug = "Levofloxacin" |
### Instruction:
Out of total number of patients admitted before 2157, how many of them had long-term use of steroids?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2175" AND diagnoses.short_title = "Long-term use steroids" |
### Instruction:
give me the number of patients whose ethnicity is black/haitian and procedure short title is bone marrow biopsy?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.ethnicity = "BLACK/HAITIAN" AND procedures.short_title = "Bone marrow biopsy" |
### Instruction:
How many of the patients with brain mass intracranial hemorrhage as their primary disease belonged to black/cape verdean ethnic origin?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND demographic.diagnosis = "BRAIN MASS;INTRACRANIAL HEMORRHAGE" |
### Instruction:
has patient 61591 had any type of diagnosis in 2105?
### Response:
| SELECT COUNT(*) > 0 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 61591) AND STRFTIME('%y', diagnoses_icd.charttime) = '2105' |
### Instruction:
how many medicines were prescribed in 08/2104 to patient 26849?
### Response:
| SELECT COUNT(*) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26849) AND STRFTIME('%y-%m', prescriptions.startdate) = '2104-08' |
Subsets and Splits