instruction
stringlengths
37
754
output
stringlengths
9
3.43k
### Instruction: what was the last dose of sodium chloride during their current hospital encounter given to patient 82132? ### Response:
SELECT prescriptions.dose_val_rx FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 82132 AND admissions.dischtime IS NULL) AND prescriptions.drug = 'sodium chloride' ORDER BY prescriptions.startdate DESC LIMIT 1
### Instruction: give me the number of patients whose admission location is trsf within this facility and drug name is cetylpyridinium chl (cepacol)? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND prescriptions.drug = "Cetylpyridinium Chl (Cepacol)"
### Instruction: give me the number of patients whose primary disease is aortic insufficiency\re-do sternotomy; aortic valve replacement and admission year is less than 2198? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "AORTIC INSUFFICIENCY\RE-DO STERNOTOMY; AORTIC VALVE REPLACEMENT " AND demographic.admityear < "2198"
### Instruction: What film was the director william a. wellman, later than 1931 with a leading man of george brent, and a Role of joan gordon, aka francine la rue? ### Response:
SELECT "Film" FROM table_51411 WHERE "Director" = 'william a. wellman' AND "Year" > '1931' AND "Leading Man" = 'george brent' AND "Role" = 'joan gordon, aka francine la rue'
### Instruction: Average response time by tags. The average response time for most popular tags (with at least one vote) ### Response:
SELECT COUNT(DISTINCT Id) AS responses, AVG(CAST((JULIANDAY(ClosedDate) - JULIANDAY(CreationDate)) * 24.0 AS INT)) AS average_response_time_in_hours FROM Posts WHERE CreationDate >= '2020-09-2' AND ClosedDate <= '2020-09-28'
### 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 phone_number and department_id , and I want to show in desc by the x axis. ### 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) ORDER BY PHONE_NUMBER DESC
### Instruction: give me the number of patients whose year of death is less than or equal to 2168 and diagnoses long title is hyperosmolality and/or hypernatremia? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dod_year <= "2168.0" AND diagnoses.long_title = "Hyperosmolality and/or hypernatremia"
### Instruction: For the dates of transactions with amount smaller than 3000, bin the date into year interval, and draw a line chart to show the trend of the number of records in each bin, list by the x axis in ascending please. ### Response:
SELECT date_of_transaction, COUNT(date_of_transaction) FROM Sales AS T1 JOIN Transactions AS T2 ON T1.sales_transaction_id = T2.transaction_id WHERE T2.amount_of_transaction < 3000 ORDER BY date_of_transaction
### Instruction: give me the number of patients whose discharge location is rehab/distinct part hosp and procedure long title is enteral infusion of concentrated nutritional substances. ### 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 = "Enteral infusion of concentrated nutritional substances"
### Instruction: What is the lowest 2010 Employees (Total) when the 2007 Employees (Total) is see note, and the 2012 Employees (Total) is larger than 99,400? ### Response:
SELECT MIN("2010 Employees (Total)") FROM table_63079 WHERE "2007 Employees (Total)" = 'see note' AND "2012 Employees (Total)" > '99,400'
### Instruction: what drugs did patient 011-55642 have an allergic reaction to in the current hospital encounter? ### Response:
SELECT allergy.drugname FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '011-55642' AND patient.hospitaldischargetime IS NULL))
### Instruction: Which Thai restaurant has the most number of reviews ### Response:
SELECT business.name FROM business, category AS CATEGORY_0, category AS CATEGORY_1 WHERE CATEGORY_0.business_id = business.business_id AND CATEGORY_0.category_name = 'restaurant' AND CATEGORY_1.business_id = business.business_id AND CATEGORY_1.category_name = 'Thai' ORDER BY business.review_count DESC LIMIT 1
### Instruction: For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, show me the trend about employee_id over hire_date with a line chart. ### Response:
SELECT HIRE_DATE, EMPLOYEE_ID FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40
### Instruction: What teacher teaches DANCE 327 ? ### Response:
SELECT DISTINCT instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'DANCE' AND course.number = 327 AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id
### Instruction: provide the number of patients whose ethnicity is hispanic/latino - puerto rican and procedure short title is exc/dest hrt lesion open? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND procedures.short_title = "Exc/dest hrt lesion open"
### Instruction: what is the yearly maximum value of potassium in patient 8098? ### Response:
SELECT MAX(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 8098) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'potassium') GROUP BY STRFTIME('%y', labevents.charttime)
### Instruction: What is the highest number of wins when earnings are larger than 150,643, more than 1 cut was made, there are more than 22 starts, and the money list rank is 32? ### Response:
SELECT MAX("Wins") FROM table_41647 WHERE "Earnings (\u20ac)" > '150,643' AND "Cuts Made" > '1' AND "Starts" > '22' AND "Money list rank" = '32'
### Instruction: count the number of patients whose diagnoses long title is 35-36 completed weeks of gestation and drug route is pr? ### 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.long_title = "35-36 completed weeks of gestation" AND prescriptions.route = "PR"
### Instruction: Provide the number of patients with hyperglycemis as the primary disease who are given the drug albuterol 0.083% neb soln. ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.diagnosis = "HYPERGLYCEMIA" AND prescriptions.drug = "Albuterol 0.083% Neb Soln"
### Instruction: provide the number of patients whose year of death is less than or equal to 2186 and procedure long title is continuous invasive mechanical ventilation for 96 consecutive hours or more? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2186.0" AND procedures.long_title = "Continuous invasive mechanical ventilation for 96 consecutive hours or more"
### Instruction: What are the enrollment dates of all the tests that have result 'Pass', and count them by a bar chart, display by the Y-axis in ascending please. ### Response:
SELECT date_of_enrolment, COUNT(date_of_enrolment) FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Pass" ORDER BY COUNT(date_of_enrolment)
### Instruction: Return the number of booking start date for the apartments that have type code 'Duplex' for each year in a bar chart, could you show by the total number from high to low please? ### Response:
SELECT booking_start_date, COUNT(booking_start_date) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.apt_type_code = "Duplex" ORDER BY COUNT(booking_start_date) DESC
### Instruction: Questions with at least two of my favorite tags. ### Response:
SELECT p.Id, p.Title, p.Body, p.Tags, p.CreationDate FROM Posts AS p INNER JOIN PostTags AS pt ON pt.PostId = p.Id INNER JOIN Tags AS t ON pt.TagId = t.Id WHERE p.PostTypeId = 1 AND p.CreationDate <= '2016-08-31 23:59:00.000' AND t.TagName IN ('security')
### Instruction: serum creatinine >= 1.5 mg / dl for male and >= 1.4 mg / dl for female or creatinine clearance < 60 ml / minutes, based on calculation by central lab using the cockcroft _ gault approximation at screening visit. ### Response:
SELECT * FROM table_train_278 WHERE (serum_creatinine >= 1.5 AND gender = 'male') OR (serum_creatinine >= 1.4 AND gender = 'female')
### Instruction: count the amount of intensive care unit visits of patient 65309 during the last year. ### Response:
SELECT COUNT(DISTINCT icustays.icustay_id) FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 65309) AND DATETIME(icustays.intime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')
### Instruction: Get the number of patients who had a creatine kinase mb isoenzyme lab test that are taking a base type drug. ### 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 = "BASE" AND lab.label = "Creatine Kinase, MB Isoenzyme"
### Instruction: provide the number of patients on po route of drug administration who have cellulitis and abscess of leg, except foot diagnoses. ### 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.long_title = "Cellulitis and abscess of leg, except foot" AND prescriptions.route = "PO"
### Instruction: Simple Search Comments + sort on display name. based on work by [@rene on Meta](http://meta.stackexchange.com/a/234278/203418) ### Response:
SELECT DISTINCT c.Id AS "comment_link", c.PostId AS "post_link", u.Id AS "user_link", u.DisplayName FROM Comments AS c INNER JOIN Users AS u ON u.Id = c.UserId WHERE c.Text LIKE '%##SearchValue##%' ORDER BY u.DisplayName
### Instruction: Cape Town developers asking questions with NODE Tag. ### Response:
SELECT DISTINCT U.* FROM Users AS U JOIN Posts AS P ON P.OwnerUserId = U.Id JOIN PostTypes AS PT ON PT.Id = P.PostTypeId WHERE UPPER(U.Location) LIKE '%CAPE TOWN%' AND (U.WebsiteUrl != '' OR U.AboutMe != '') AND PT.Name IN ('Question', 'Answer') AND UPPER(P.Tags) LIKE '%NODE%' ORDER BY U.Reputation DESC
### Instruction: what is the number of patients whose diagnoses short title is stevens-johnson-ten syn and drug route is pb? ### 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 = "Stevens-Johnson-TEN syn" AND prescriptions.route = "PB"
### 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 phone_number and department_id , and could you list from low to high by the bars? ### 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) ORDER BY PHONE_NUMBER
### Instruction: High-rep Users with only one post. ### Response:
SELECT u.Id AS "user_link", u.Reputation FROM Users AS u, Posts AS p WHERE u.Reputation > '##RepThreshold:int?10000##' AND u.Id = p.OwnerUserId AND p.PostTypeId IN (1, 2) GROUP BY u.Id, u.Reputation HAVING COUNT(p.Id) = 1 AND NOT COUNT(p.Id) > 1 ORDER BY u.Reputation DESC
### Instruction: Find the name of the person who has friends with age above 40 but not under age 30? ### Response:
SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age > 40) EXCEPT SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age < 30)
### Instruction: All questions tagged with three tags, formatted for copying out links. ### Response:
SELECT q.Id AS "Id", 'http://chemistry.stackexchange.com/q/' + CAST(q.Id AS TEXT(15)) AS "Link" FROM Posts AS q WHERE q.PostTypeId = 1 AND q.Tags LIKE '%<' + @Tag1 + '>%' AND q.Tags LIKE '%<' + @Tag2 + '>%' AND q.Tags LIKE '%<' + @Tag3 + '>%' ORDER BY q.Id
### Instruction: For those employees who do not work in departments with managers that have ids between 100 and 200, draw a line chart about the change of manager_id over hire_date , I want to rank by the X in ascending. ### Response:
SELECT HIRE_DATE, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY HIRE_DATE
### Instruction: Semantic Parsing paper by li dong ### Response:
SELECT DISTINCT author.authorid, paper.paperid FROM author, keyphrase, paper, paperkeyphrase, writes WHERE author.authorname = 'li dong' AND keyphrase.keyphrasename = 'Semantic Parsing' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid AND writes.authorid = author.authorid AND writes.paperid = paper.paperid
### Instruction: what were the five most frequent event in the output since 3 years ago? ### Response:
SELECT t1.celllabel FROM (SELECT intakeoutput.celllabel, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM intakeoutput WHERE intakeoutput.cellpath LIKE '%output%' AND DATETIME(intakeoutput.intakeoutputtime) >= DATETIME(CURRENT_TIME(), '-3 year') GROUP BY intakeoutput.celllabel) AS t1 WHERE t1.c1 <= 5
### Instruction: count the number of patients who have undergone the procedure of valve replacement or repair - emergent the previous year. ### Response:
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'valve replacement or repair - emergent' AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year'))
### 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 manager_id over hire_date , order from low to high by the x-axis. ### Response:
SELECT HIRE_DATE, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY HIRE_DATE
### Instruction: count the number of patients who have been on intake, gi tube flush intake in 2105. ### Response:
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT intakeoutput.patientunitstayid FROM intakeoutput WHERE intakeoutput.celllabel = 'intake, gi tube flush' AND intakeoutput.cellpath LIKE '%input%' AND STRFTIME('%y', intakeoutput.intakeoutputtime) = '2105')
### Instruction: List the document ids of documents with the status done and type Paper, which not shipped by the shipping agent named USPS. ### Response:
SELECT document_id FROM documents WHERE document_status_code = "done" AND document_type_code = "Paper" EXCEPT SELECT document_id FROM documents JOIN ref_shipping_agents ON documents.shipping_agent_code = ref_shipping_agents.shipping_agent_code WHERE ref_shipping_agents.shipping_agent_name = "USPS"
### Instruction: Which 2006 07 Pts has a 2007 08 Pts of 53, and a 2005 06 Pts larger than 51? ### Response:
SELECT MAX("2006\u201307 Pts") FROM table_13023 WHERE "2007\u201308 Pts" = '53' AND "2005\u201306 Pts" > '51'
### Instruction: count the number of patients whose diagnoses icd9 code is 49392 and drug type is additive? ### 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.icd9_code = "49392" AND prescriptions.drug_type = "ADDITIVE"
### Instruction: count the number of patients whose year of death is less than or equal to 2132 and diagnoses long title is other pulmonary insufficiency, not elsewhere classified? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dod_year <= "2132.0" AND diagnoses.long_title = "Other pulmonary insufficiency, not elsewhere classified"
### Instruction: what was the top three most common diagnosis the last year? ### Response:
SELECT t1.diagnosisname FROM (SELECT diagnosis.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnosis WHERE DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY diagnosis.diagnosisname) AS t1 WHERE t1.c1 <= 3
### Instruction: Which county has a % (2040) larger than 1.8, a % (2000) smaller than 4.1, a % (1960) smaller than 3.2, and is ranked 13? ### Response:
SELECT county FROM table_name_82 WHERE _percentage__2040_ > 1.8 AND _percentage__2000_ < 4.1 AND _percentage__1960_ < 3.2 AND rank = "13"
### Instruction: Which courses in Directed Russian Literature satisfy the current MDE requirement ? ### Response:
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN area ON course.course_id = area.course_id INNER JOIN program_course ON program_course.course_id = course.course_id WHERE (area.area LIKE '%Directed Russian Literature%' OR course.description LIKE '%Directed Russian Literature%' OR course.name LIKE '%Directed Russian Literature%') AND program_course.category LIKE '%MDE%'
### Instruction: What is Date to [H], when Position [F] is 'Defender', when Goals is less than 3, when Appearances is greater than 113, and when Date From [G] is '1997'? ### Response:
SELECT "Date to [H ]" FROM table_9519 WHERE "Position [F ]" = 'defender' AND "Goals" < '3' AND "Appearances" > '113' AND "Date from [G ]" = '1997'
### Instruction: when patient 1819 was admitted to the hospital via the phys referral/normal deli for the last time this year? ### Response:
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 1819 AND admissions.admission_location = 'phys referral/normal deli' AND DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') ORDER BY admissions.admittime DESC LIMIT 1
### Instruction: Top Five Answers by Tag Name. ### Response:
SELECT q.Id AS "question_link", a.Id, a.Score, q.Tags, u.DisplayName FROM Posts AS q JOIN Posts AS a ON q.AcceptedAnswerId = a.Id JOIN Users AS u ON a.OwnerUserId = u.Id WHERE 0 = 0 AND q.Tags LIKE '%facebook-graph-api%' AND q.PostTypeId = 1 AND a.PostTypeId = 2 ORDER BY a.Score DESC LIMIT 100
### Instruction: Courses in Continental Rationalism that satisfy the MDE requirement ? ### Response:
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN area ON course.course_id = area.course_id INNER JOIN program_course ON program_course.course_id = course.course_id WHERE (area.area LIKE '%Continental Rationalism%' OR course.description LIKE '%Continental Rationalism%' OR course.name LIKE '%Continental Rationalism%') AND program_course.category LIKE '%MDE%'
### Instruction: During the Spring-Summer 2003 will the CHE 995 class be available ? ### Response:
SELECT COUNT(*) > 0 FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'CHE' AND course.number = 995 AND semester.semester = 'Spring-Summer' AND semester.semester_id = course_offering.semester AND semester.year = 2003
### Instruction: what were the top three most common diagnosis during this year? ### Response:
SELECT t1.diagnosisname FROM (SELECT diagnosis.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnosis WHERE DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY diagnosis.diagnosisname) AS t1 WHERE t1.c1 <= 3
### Instruction: how many of the patients with unspecified protein-calorie malnutrition were treated with a base drug? ### 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.long_title = "Unspecified protein-calorie malnutrition" AND prescriptions.drug_type = "BASE"
### Instruction: What is the number of booking end dates of the apartments with type code 'Duplex' in each year? Return a bar chart, could you show from low to high by the Y-axis? ### Response:
SELECT booking_end_date, COUNT(booking_end_date) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.apt_type_code = "Duplex" ORDER BY COUNT(booking_start_date)
### Instruction: provide the number of patients whose diagnoses short title is long-term use of aspirin and drug route is iv bolus? ### 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 = "Long-term use of aspirin" AND prescriptions.route = "IV BOLUS"
### Instruction: What are the names of catalog entries with level number 8, and count them by a bar chart, and display from high to low by the Y-axis. ### Response:
SELECT catalog_entry_name, COUNT(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.catalog_level_number = "8" GROUP BY catalog_entry_name ORDER BY COUNT(catalog_entry_name) DESC
### Instruction: When 2000-2005 is smaller than 2.52, and 1990-1995 is less than 0.37, what's the total of 1995-2000? ### Response:
SELECT SUM("1995-2000") FROM table_34952 WHERE "2000-2005" < '2.52' AND "1990-1995" < '0.37'
### Instruction: what is the number of patients categorized under chemistry lab test who had open reduction of femur fracture with internal fixation? ### 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 reduction of fracture with internal fixation, femur" AND lab."CATEGORY" = "Chemistry"
### Instruction: how many patients are diagnosed with unspecified coagulation defects and used the additive drug type? ### 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.long_title = "Other and unspecified coagulation defects" AND prescriptions.drug_type = "ADDITIVE"
### Instruction: Number of answers by me last year for .NET/C#. ### Response:
SELECT COUNT(*) FROM Posts AS q INNER JOIN Posts AS a ON q.Id = a.ParentId AND a.PostTypeId = 2 AND q.PostTypeId = 1 WHERE a.CommunityOwnedDate IS NULL AND a.OwnerUserId = '##UserId##' AND a.CreationDate >= '##StartDate##' AND a.CreationDate <= '##EndDate##' AND (q.Tags LIKE '##Tag##')
### Instruction: Tell me all the courses in Sci Lab Rotations which the requirement of Other . ### Response:
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN area ON course.course_id = area.course_id INNER JOIN program_course ON program_course.course_id = course.course_id WHERE (area.area LIKE '%Sci Lab Rotations%' OR course.description LIKE '%Sci Lab Rotations%' OR course.name LIKE '%Sci Lab Rotations%') AND program_course.category LIKE '%Other%'
### Instruction: What are my score in subjects taught by Prof. Sundararaghavan ? ### Response:
SELECT DISTINCT student_record.grade FROM student_record INNER JOIN offering_instructor ON student_record.offering_id = offering_instructor.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id WHERE LOWER(instructor.name) LIKE '%Sundararaghavan%' AND student_record.student_id = 1
### Instruction: Which 9.72 g (150 gr) has a Bullet weight gram (grain) of .325 wsm, and an 8.23 g (127 gr) smaller than 108.7? ### Response:
SELECT AVG("9.72 g (150 gr)") FROM table_5325 WHERE "Bullet weight gram (grain)" = '.325 wsm' AND "8.23 g (127 gr)" < '108.7'
### Instruction: Which model was made from 2001 2004, with a Torque of n m (lb ft) @ 3750, and an Engine code of n42b18 / n46b18? ### Response:
SELECT model FROM table_name_72 WHERE years = "2001–2004" AND torque = "n·m (lb·ft) @ 3750" AND engine_code = "n42b18 / n46b18"
### Instruction: how many patients is methylprednisolone sodium succ prescribed to the last year? ### Response:
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT prescriptions.hadm_id FROM prescriptions WHERE prescriptions.drug = 'methylprednisolone sodium succ' AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year'))
### Instruction: Show the accelerator names and supporting operating systems that are not compatible with the browser named 'Opera'. ### Response:
SELECT name, operating_system FROM web_client_accelerator EXCEPT SELECT T1.name, T1.operating_system FROM web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id JOIN browser AS T3 ON T2.browser_id = T3.id WHERE T3.name = 'Opera'
### Instruction: count the number of patients whose diagnosis short title is follicular cyst of ovary and drug route is buccal. ### 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 = "Follicular cyst of ovary" AND prescriptions.route = "BUCCAL"
### Instruction: what is the cost of meningismus diagnostic? ### Response:
SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'diagnoses_icd' AND cost.event_id IN (SELECT diagnoses_icd.row_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'meningismus'))
### Instruction: count the number of patients who are prescribed additive type drugs and diagnosed with iron defic anemia nos. ### 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 = "Iron defic anemia NOS" AND prescriptions.drug_type = "ADDITIVE"
### Instruction: Posts containing the given word. ### Response:
SELECT DISTINCT p.Id AS "post_link", p.OwnerUserId AS "user_link", p.LastActivityDate, p.CreationDate, url = 'site://posts/' + CAST(p.Id AS TEXT) + '/revisions' FROM Posts AS p JOIN PostHistory AS ph ON (ph.PostId = p.Id) WHERE (p.Body LIKE '%##word?\let##%') ORDER BY p.LastActivityDate DESC LIMIT 100
### Instruction: when the last time patient 3712 was prescribed a medicine via oral route in the last hospital visit? ### Response:
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 3712 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND prescriptions.route = 'oral' ORDER BY prescriptions.startdate DESC LIMIT 1
### Instruction: What is the most cited paper of behcet acikmese ? ### Response:
SELECT DISTINCT cite.citedpaperid, COUNT(cite.citedpaperid) FROM author, cite, paper, writes WHERE author.authorname = 'behcet acikmese' AND paper.paperid = cite.citedpaperid AND writes.authorid = author.authorid AND writes.paperid = paper.paperid GROUP BY cite.citedpaperid ORDER BY COUNT(cite.citedpaperid) DESC
### Instruction: Show a bar graph, the data is those times of trains that run through stations for the local authority Chiltern, and the Y axis is the total number of different times, I want to rank by the y axis in asc. ### Response:
SELECT time, COUNT(time) FROM station AS t1 JOIN route AS t2 ON t1.id = t2.station_id JOIN train AS t3 ON t2.train_id = t3.id WHERE t1.local_authority = "Chiltern" GROUP BY time ORDER BY COUNT(time)
### Instruction: when did until 13 months ago patient 86206 last receive a microbiology test? ### Response:
SELECT microbiologyevents.charttime FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 86206) AND DATETIME(microbiologyevents.charttime) <= DATETIME(CURRENT_TIME(), '-13 month') ORDER BY microbiologyevents.charttime DESC LIMIT 1
### Instruction: what is the number of patients whose diagnoses short title is 31-32 comp wks gestation 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 = "31-32 comp wks gestation" AND lab.flag = "abnormal"
### 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 hire_date and the sum of employee_id bin hire_date by weekday in a bar chart. ### Response:
SELECT HIRE_DATE, SUM(EMPLOYEE_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
### Instruction: give me the number of patients whose marital status is widowed and lab test chart time is 2108-09-28 03:52:00? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "WIDOWED" AND lab.charttime = "2108-09-28 03:52:00"
### Instruction: what were the five drugs that were ordered the most frequently in this year? ### Response:
SELECT t1.drugname FROM (SELECT medication.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM medication WHERE DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY medication.drugname) AS t1 WHERE t1.c1 <= 5
### Instruction: What grades have I received in courses that Prof. Papagerakis has taught ? ### Response:
SELECT DISTINCT student_record.grade FROM student_record INNER JOIN offering_instructor ON student_record.offering_id = offering_instructor.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id WHERE LOWER(instructor.name) LIKE '%Papagerakis%' AND student_record.student_id = 1
### Instruction: count the number of visits to the intensive care unit of patient 021-139760 in 2102. ### Response:
SELECT COUNT(DISTINCT patient.patientunitstayid) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-139760') AND STRFTIME('%y', patient.unitadmittime) = '2102'
### Instruction: what is the number of patients on main type of drug prescription who have the diagnoses of other respiratory problems after birth? ### 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.long_title = "Other respiratory problems after birth" AND prescriptions.drug_type = "MAIN"
### Instruction: For those employees who do not work in departments with managers that have ids between 100 and 200, give me the trend about department_id over hire_date , and could you display by the X-axis in ascending? ### 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) ORDER BY HIRE_DATE
### Instruction: What is the sum of revenue in Hong Kong with a rank greater than 42, less than $3.46 billion in assets, and greater than $0.17 billion in profits? ### Response:
SELECT SUM("Revenue (Bn.$)") FROM table_47307 WHERE "Assets (Bn.$)" < '3.46' AND "Headquarters" = 'hong kong' AND "Profit (Bn.$)" > '0.17' AND "Rank" > '42'
### Instruction: what is the number of patients on main drug type prescription who are diagnosed with malignant neoplasm of descending colon? ### 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 = "Mal neo descend colon" AND prescriptions.drug_type = "MAIN"
### Instruction: how many people have had replace nephrostomy tube done? ### Response:
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT procedures_icd.hadm_id FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'replace nephrostomy tube'))
### Instruction: What are the descriptions of the categories that products with product descriptions that contain the letter t are in, and count them by a bar chart, could you rank x axis from low to high order? ### 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
### Instruction: what is the listing for 2012 when 2004 is more than 0, 2008 is more than 1 1994 is 8 and 2005 is less than 11? ### Response:
SELECT MIN("2012") FROM table_67537 WHERE "2004" > '0' AND "2008" > '1' AND "1994" = '8' AND "2005" < '11'
### Instruction: count the number of patients whose diagnosis short title is mental disor nec oth dis and lab test category is blood gas. ### 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 = "Mental disor NEC oth dis" AND lab."CATEGORY" = "Blood Gas"
### Instruction: give me the number of patients whose diagnoses long title is infectious mononucleosis and drug type is base? ### 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.long_title = "Infectious mononucleosis" AND prescriptions.drug_type = "BASE"
### Instruction: For those employees who do not work in departments with managers that have ids between 100 and 200, return a bar chart about the distribution of first_name and manager_id , sort FIRST_NAME in desc order. ### Response:
SELECT FIRST_NAME, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY FIRST_NAME DESC
### 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 job_id and commission_pct in a bar chart, rank in ascending by the x axis. ### 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) ORDER BY JOB_ID
### Instruction: For those employees who do not work in departments with managers that have ids between 100 and 200, a bar chart shows the distribution of job_id and department_id , and list in ascending by the DEPARTMENT_ID please. ### Response:
SELECT JOB_ID, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY DEPARTMENT_ID
### Instruction: give me the number of patients whose ethnicity is white and primary disease is atrial septal defect\mitral valve replacement;repair atrial-septal defect/sda? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "WHITE" AND demographic.diagnosis = "ATRIAL SEPTAL DEFECT\MITRAL VALVE REPLACEMENT;REPAIR ATRIAL-SEPTAL DEFECT/SDA"
### Instruction: A bar chart for returning the number of the completion date for all the tests that have 'Fail' result, and sort in desc by the X-axis. ### Response:
SELECT date_of_completion, COUNT(date_of_completion) FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Fail" GROUP BY date_of_completion ORDER BY date_of_completion DESC
### Instruction: how many patients whose diagnoses short title is glucocorticoid deficient and lab test category is hematology? ### 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 = "Glucocorticoid deficient" AND lab."CATEGORY" = "Hematology"
### Instruction: give me the number of patients whose discharge location is dead/expired and diagnoses long title is aftercare for healing traumatic fracture of lower leg? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.discharge_location = "DEAD/EXPIRED" AND diagnoses.long_title = "Aftercare for healing traumatic fracture of lower leg"
### Instruction: For those employees who do not work in departments with managers that have ids between 100 and 200, return a bar chart about the distribution of last_name and department_id , and I want to show in asc by the LAST_NAME. ### Response:
SELECT LAST_NAME, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY LAST_NAME
### Instruction: what is the number of patients whose diagnoses short title is long-term use of insulin and lab test name is urobilinogen? ### 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 = "Long-term use of insulin" AND lab.label = "Urobilinogen"
### Instruction: When did qiang ma publish his MapReduce paper ? ### Response:
SELECT DISTINCT paper.year FROM author, keyphrase, paper, paperkeyphrase, writes WHERE author.authorname = 'qiang ma' AND keyphrase.keyphrasename = 'MapReduce' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid AND writes.authorid = author.authorid AND writes.paperid = paper.paperid