instruction
stringlengths
37
754
output
stringlengths
9
3.43k
### Instruction: Which seniors have a year before 2007, Fourths (Under 14's) of kiewa-sandy creek, and a Reserve of mitta united? ### Response:
SELECT "Seniors" FROM table_77630 WHERE "YEAR" < '2007' AND "Fourths (Under 14's)" = 'kiewa-sandy creek' AND "Reserves" = 'mitta united'
### Instruction: VBA Question Answer'ers with the TOP REP. ### Response:
SELECT u.DisplayName, u.Reputation AS ActualRep, COUNT(a.Id) AS NumAnswers, LastAccessDate FROM Posts AS q, Posts AS a, Users AS u WHERE q.Tags LIKE '%vba%' AND a.OwnerUserId = u.Id AND a.ParentId = q.Id GROUP BY u.DisplayName, u.Reputation, LastAccessDate ORDER BY u.Reputation DESC
### Instruction: Tell me the number of patients with diagnoses icd9 code 1532 who had blood lab tests done. ### 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.icd9_code = "1532" AND lab.fluid = "Blood"
### Instruction: Cass county has 0.008 Water (sqmi), less than 35.874 Land (sqmi), more than 35 Pop. (2010), and what average latitude? ### Response:
SELECT AVG(latitude) FROM table_name_72 WHERE land___sqmi__ < 35.874 AND pop__2010_ > 35 AND county = "cass" AND water__sqmi_ = 0.008
### Instruction: what is patient 17638's first ward on the last hospital visit? ### Response:
SELECT transfers.wardid FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 17638 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND NOT transfers.wardid IS NULL ORDER BY transfers.intime LIMIT 1
### Instruction: Top 10 SO Users from Mysore. Top 10 SO Users from Mysore, Karnataka, India ### Response:
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation, Location FROM Users WHERE LOWER(Location) LIKE '%mysore%' OR UPPER(Location) LIKE '%MYSORE%' OR Location LIKE '%mysore%' AND Reputation >= 1000 ORDER BY Reputation DESC LIMIT 10
### Instruction: What is the highest latitude when there are more than 0.518 square miles of water, a longitude less than -99.830606, and a population of 18? ### Response:
SELECT MAX("Latitude") FROM table_64884 WHERE "Water (sqmi)" > '0.518' AND "Longitude" < '-99.830606' AND "Pop. (2010)" = '18'
### Instruction: For those employees who was hired before 2002-06-21, return a bar chart about the distribution of job_id and the sum of manager_id , and group by attribute job_id, and I want to order names in descending order. ### Response:
SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY JOB_ID DESC
### Instruction: List all every engineer's first name, last name, details and coresponding skill description. ### Response:
SELECT T1.first_name, T1.last_name, T1.other_details, T3.skill_description FROM Maintenance_Engineers AS T1 JOIN Engineer_Skills AS T2 ON T1.engineer_id = T2.engineer_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id
### Instruction: Closed questions on a tag with 1 <= score <= 5. ### Response:
SELECT Posts.Id AS "post_link", Posts.CreationDate, Posts.Score, Posts.ClosedDate FROM Posts WHERE (Posts.Score >= 1 AND Posts.Score <= 5) AND Posts.AcceptedAnswerId IS NULL AND (NOT Posts.ClosedDate IS NULL) AND Tags LIKE '##Tag##' ORDER BY Posts.Score DESC LIMIT 50
### Instruction: what is the number of patients whose year of death is less than or equal to 2186 and diagnoses icd9 code is 78321? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dod_year <= "2186.0" AND diagnoses.icd9_code = "78321"
### Instruction: major depression in past 12 months ( dsm _ iv criteria ) , major mental illness such as schizophrenia, or recent ( in past 12 months ) alcohol or substance abuse. ### Response:
SELECT * FROM table_train_123 WHERE major_depression = 1 OR (major_mental_illness = 1 OR schizophrenia = 1 OR alcohol_abuse = 1 OR substance_dependence = 1)
### Instruction: What is the highest number of matches for Australia when the wickets are more than 13, the average is less than 23.33, and the best bowling is 5/36? ### Response:
SELECT MAX("Matches") FROM table_49939 WHERE "Wickets" > '13' AND "Team" = 'australia' AND "Best Bowling" = '5/36' AND "Average" < '23.33'
### Instruction: How many hispanic, latino, or puerto rican patients are on drug named sucralfate? ### 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 = "Sucralfate"
### Instruction: what is the number of patients whose admission location is trsf within this facility and drug name is levothyroxine sodium? ### 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 = "Levothyroxine Sodium"
### Instruction: what was the last care unit that patient 8888 went in 2105? ### Response:
SELECT transfers.careunit FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 8888) AND NOT transfers.careunit IS NULL AND STRFTIME('%y', transfers.intime) = '2105' ORDER BY transfers.intime DESC LIMIT 1
### Instruction: what is the number of patients whose diagnoses long title is atrial flutter 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.long_title = "Atrial flutter" AND lab."CATEGORY" = "Blood Gas"
### Instruction: Total count of up- and downvotes in the system from the Users and the Votes table. ### Response:
SELECT 'Users Table' AS Source, SUM(UpVotes) AS Ups, SUM(DownVotes) AS Downs FROM Users UNION SELECT 'Votes Table' AS Source, COUNT(CASE WHEN VoteTypeId = 2 THEN 1 ELSE NULL END) AS Ups, COUNT(CASE WHEN VoteTypeId = 3 THEN 1 ELSE NULL END) AS Downs FROM Votes
### Instruction: what is the last careunit of patient 47224 in their first hospital visit? ### Response:
SELECT transfers.careunit FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 47224 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) AND NOT transfers.careunit IS NULL ORDER BY transfers.intime DESC LIMIT 1
### Instruction: what are the top three most commonly prescribed medicines since 1 year ago? ### Response:
SELECT t1.drugname FROM (SELECT medication.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM medication WHERE DATETIME(medication.drugstarttime) >= DATETIME(CURRENT_TIME(), '-1 year') GROUP BY medication.drugname) AS t1 WHERE t1.c1 <= 3
### Instruction: Who writes a lot of papers in Machine Learning ? ### Response:
SELECT DISTINCT author.authorname FROM author, keyphrase, paperkeyphrase, writes WHERE keyphrase.keyphrasename = 'Machine Learning' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND writes.authorid = author.authorid AND writes.paperid = paperkeyphrase.paperid GROUP BY author.authorname ORDER BY COUNT(DISTINCT writes.paperid) DESC
### Instruction: TeX.SX \\ corruption (tabs) with edit link. ### Response:
SELECT p.Id AS "post_link", 'site://posts/' + CAST(p.Id AS TEXT) + '/edit|' + 'Edit' AS "edit_link", p.CreationDate FROM Posts AS p WHERE ((REPLACE(REPLACE(p.Body, '\\', ''), CHAR(9), 'X') LIKE '%\X%')) ORDER BY p.CreationDate DESC
### Instruction: tell me the first careunit patient 11579 got since 2103? ### Response:
SELECT transfers.careunit FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 11579) AND NOT transfers.careunit IS NULL AND STRFTIME('%y', transfers.intime) >= '2103' ORDER BY transfers.intime LIMIT 1
### Instruction: find the program owners that have some programs in both morning and night time. ### Response:
SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.time_of_day = "Morning" INTERSECT SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.time_of_day = "Night"
### Instruction: what is the number of patients whose primary disease is guillain barre syndrome and procedure short title is int insert 1-cham, rate? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "GUILLAIN BARRE SYNDROME" AND procedures.short_title = "Int insert 1-cham, rate"
### Instruction: For those employees who did not have any job in the past, give me the comparison about the amount of hire_date over the hire_date bin hire_date by weekday by a bar chart, and I want to list y axis in descending order. ### Response:
SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY COUNT(HIRE_DATE) DESC
### Instruction: Show birthdates of the professors in charge of ACCT-211 and bin the date by year interval in a line chart, could you sort X in ascending order please? ### Response:
SELECT EMP_DOB, COUNT(EMP_DOB) FROM EMPLOYEE AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM = T2.PROF_NUM WHERE CRS_CODE = "ACCT-211" ORDER BY EMP_DOB
### Instruction: what is the number of patients whose diagnoses short title is paraplegia nos 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 = "Paraplegia NOS" AND lab.flag = "abnormal"
### Instruction: What is the lowest number of cf wins of the chicago blackhawks, which has more than 4 cf appearances, a last cf in 2013, and more than 2 cup wins? ### Response:
SELECT MIN("CF wins") FROM table_60295 WHERE "CF appearances" > '4' AND "Last CF" = '2013' AND "Team" = 'chicago blackhawks' AND "Cup wins" > '2'
### Instruction: how many patients from hispanic/latino ethnic origin had open incis hern-grft nec? ### 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 = "Open incis hern-grft NEC"
### Instruction: in total, count the number of patients who have been prescribed albuterol neb until 1 year ago. ### Response:
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'albuterol neb' AND DATETIME(medication.drugstarttime) <= DATETIME(CURRENT_TIME(), '-1 year'))
### Instruction: Recent top answerers in the 'algorithm' tag. ### Response:
SELECT Users.DisplayName, SUM(Score) AS Score FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts ON Posts.ParentId = PostTags.PostId INNER JOIN Users ON Posts.OwnerUserId = Users.Id WHERE Posts.CommunityOwnedDate IS NULL AND Tags.TagName = 'algorithm' GROUP BY Users.DisplayName ORDER BY Score DESC LIMIT 20
### Instruction: Find the number of the names of catalog entries with level number 8, display Y-axis in ascending order. ### 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)
### Instruction: Show the date and the corresponding sales of the journal which did not have any of the listed editors serving on the committee by a bar chart, and rank X-axis in ascending order. ### Response:
SELECT T1.Date, T1.Sales FROM journal EXCEPT SELECT T1.Date, T1.Theme, T1.Sales FROM journal AS T1 JOIN journal_committee AS T2 ON T1.Journal_ID = T2.Journal_ID ORDER BY T1.Date
### Instruction: when did patient 53015 enter the hospital until 2104 for the last time via the phys referral/normal deli? ### Response:
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 53015 AND admissions.admission_location = 'phys referral/normal deli' AND STRFTIME('%y', admissions.admittime) <= '2104' ORDER BY admissions.admittime DESC LIMIT 1
### Instruction: provide the number of patients on main type of drug prescription who had manual reticulocyte count. ### 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 = "MAIN" AND lab.label = "Reticulocyte Count, Manual"
### Instruction: how many patients whose year of death is less than or equal to 2186 and procedure short title is drsl/dslmb fus post/post? ### 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.short_title = "Drsl/dslmb fus post/post"
### Instruction: count the number of patients who have been treated with a analgesics procedure in the last year. ### Response:
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'analgesics' AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year'))
### Instruction: when did patient 13528, for the first time since 2100, get into the hospital via transfer from skilled nur? ### Response:
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 13528 AND admissions.admission_location = 'transfer from skilled nur' AND STRFTIME('%y', admissions.admittime) >= '2100' ORDER BY admissions.admittime LIMIT 1
### Instruction: give me the number of patients whose admission location is transfer from hosp/extram and procedure long title is radical neck dissection, unilateral? ### 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.long_title = "Radical neck dissection, unilateral"
### Instruction: Which Margin of victory has a Year larger than 1994, and a To par of 14, and a Score of 69-67-69-69=274? ### Response:
SELECT "Margin of victory" FROM table_39229 WHERE "Year" > '1994' AND "To par" = '–14' AND "Score" = '69-67-69-69=274'
### Instruction: Does luke zettlemoyer have a paper in siggraph in 2016 ? ### Response:
SELECT DISTINCT paper.paperid FROM author, paper, venue, writes WHERE author.authorname = 'luke zettlemoyer' AND paper.year = 2016 AND venue.venueid = paper.venueid AND venue.venuename = 'siggraph' AND writes.authorid = author.authorid AND writes.paperid = paper.paperid
### Instruction: Bumped by Community User (more than 5 times). ### Response:
SELECT P.Id AS "post_link", B.BumpCount, P.Score, P.CreationDate, P.Title FROM Posts AS P JOIN (SELECT PostId, COUNT(*) AS BumpCount FROM PostHistory WHERE PostHistoryTypeId = 50 GROUP BY PostId HAVING COUNT(*) > 5) AS B ON P.Id = B.PostId ORDER BY B.BumpCount DESC, PostId
### Instruction: School with highest ratio of total revenue and average scores ### Response:
SELECT T1.school_district, MAX(T1.t_fed_rev / T3.average_scale_score) FROM finrev_fed_17 AS T1 JOIN finrev_fed_key_17 AS T2 ON T1.state_code = T2.state_code JOIN ndecoreexcel_math_grade8 AS T3 ON T2.state = T3.state
### Instruction: when is the first procedure patient 29971 received until 2103? ### Response:
SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 29971) AND STRFTIME('%y', procedures_icd.charttime) <= '2103' ORDER BY procedures_icd.charttime LIMIT 1
### Instruction: For all employees who have the letters D or S in their first name, visualize a bar chart about the distribution of hire_date and the sum of employee_id bin hire_date by weekday, order by the y-axis from low to high. ### Response:
SELECT HIRE_DATE, SUM(EMPLOYEE_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY SUM(EMPLOYEE_ID)
### Instruction: Achievement of m (ft), and a Type of mi-10r, and a Pilot of v.p. koloshenko, and a Date of 28 may 1965 had what record description? ### Response:
SELECT record_description FROM table_name_96 WHERE achievement = "m (ft)" AND type = "mi-10r" AND pilot = "v.p. koloshenko" AND date = "28 may 1965"
### Instruction: what is the number of patients whose diagnoses long title is other alteration of consciousness and lab test fluid is blood? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Other alteration of consciousness" AND lab.fluid = "Blood"
### Instruction: which bank has four times as many assets at taib yatirim bank ? ### Response:
SELECT "bank" FROM table_202_236 WHERE "total assets (million tl)\nas of 30 september 2012" = (SELECT "total assets (million tl)\nas of 30 september 2012" FROM table_202_236 WHERE "bank" = 'taib yatırım bank') * 4
### Instruction: how many patients whose ethnicity is american indian/alaska native and procedure short title is contr cerebr arteriogram? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND procedures.short_title = "Contr cerebr arteriogram"
### Instruction: give the number of patients whose diagnosis short title is heart valve replacement nec and lab test abnormal status is delta. ### 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 = "Heart valve replac NEC" AND lab.flag = "delta"
### Instruction: what was patient 99661's first careunit until 2102? ### Response:
SELECT transfers.careunit FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 99661) AND NOT transfers.careunit IS NULL AND STRFTIME('%y', transfers.intime) <= '2102' ORDER BY transfers.intime LIMIT 1
### Instruction: What is the latitude that has a sqmi smaller than 34.401, a Geo ID smaller than 3807157722, and a Longitude of -98.475995? ### Response:
SELECT latitude FROM table_name_18 WHERE land___sqmi__ < 34.401 AND geo_id < 3807157722 AND longitude = -98.475995
### Instruction: calculate the number of patients who remained admitted in hospital for more than 10 days and treated with lidocaine jelly 2% (urojet) ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "10" AND prescriptions.drug = "Lidocaine Jelly 2% (Urojet)"
### Instruction: how many patients whose discharge location is disc-tran cancer/chldrn h and procedure short title is parent infus nutrit sub? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "DISC-TRAN CANCER/CHLDRN H" AND procedures.short_title = "Parent infus nutrit sub"
### Instruction: Number of answers by a user in a timeframe. ### Response:
SELECT Id AS "post_link", CreationDate FROM Posts WHERE OwnerUserId = '##UserId:int?4945##' AND PostTypeId = 2 AND CreationDate BETWEEN '2018-04-01 00:00:00' AND '2019-04-01 00:00:00' LIMIT 10
### Instruction: How many instructors are in each department? Show me a bar chart, and show by the y axis from high to low. ### 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 COUNT(DISTINCT T3.ID) DESC
### Instruction: what is the number of patients whose drug code is norebase and lab test fluid is blood? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.formulary_drug_cd = "NOREBASE" AND lab.fluid = "Blood"
### Instruction: For this upcoming Winter semester , what classes will be available ? ### Response:
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND semester.semester = 'Winter' AND semester.semester_id = course_offering.semester AND semester.year = 2016
### Instruction: what is the number of patients whose primary disease is aortic valve insuffiency\aortic valve replacement /sda and year of birth is less than 2074? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "AORTIC VALVE INSUFFIENCY\AORTIC VALVE REPLACEMENT /SDA" AND demographic.dob_year < "2074"
### Instruction: Who is the opponent of the match with a H/A of h, Beguiristain Iceta as the referee, and a kick off at 1993-04-18 17:00? ### Response:
SELECT opponents FROM table_name_50 WHERE h___a = "h" AND referee = "beguiristain iceta" AND kick_off = "1993-04-18 17:00"
### Instruction: have a fridericia's corrected qt interval ( qtcf ) greater than ( > ) 450 milliseconds ( ms ) for male or 470 ms for female ### Response:
SELECT * FROM table_train_143 WHERE (gender = 'male' AND fridericia_corrected_qt_interval_qtcf > 450) OR (gender = 'female' AND fridericia_corrected_qt_interval_qtcf > 470)
### Instruction: For all employees who have the letters D or S in their first name, give me the comparison about the average of department_id over the job_id , and group by attribute job_id by a bar chart, rank by the total number in asc. ### Response:
SELECT JOB_ID, AVG(DEPARTMENT_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY AVG(DEPARTMENT_ID)
### Instruction: when patient 28966 last got surgery in 2100. ### Response:
SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 28966) AND STRFTIME('%y', procedures_icd.charttime) = '2100' ORDER BY procedures_icd.charttime DESC LIMIT 1
### Instruction: For all employees who have the letters D or S in their first name, visualize a bar chart about the distribution of hire_date and the average of manager_id bin hire_date by time, I want to order by the Y-axis in ascending please. ### Response:
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY AVG(MANAGER_ID)
### Instruction: What is Province, when 2006 is less than 153748, when Date of Official Foundation of Municipality is after 1958, and when City is 'Pakdasht'? ### Response:
SELECT "Province" FROM table_44172 WHERE "2006" < '153748' AND "Date of Official Foundation of Municipality" > '1958' AND "City" = 'pakdasht'
### Instruction: provide the number of patients whose diagnosis icd9 code is v202 and lab test fluid is urine. ### 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.icd9_code = "V202" AND lab.fluid = "Urine"
### 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 email , rank in desc by the bars. ### Response:
SELECT EMAIL, COMMISSION_PCT FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY EMAIL DESC
### Instruction: give me the number of patients whose diagnoses short title is abnormal loss of weight and lab test fluid is pleural? ### 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 = "Abnormal loss of weight" AND lab.fluid = "Pleural"
### Instruction: What is the smallest amount of freight carried on the road that closed on March 31 and reached super B capacity on February 17 after 2011? ### Response:
SELECT MIN("Freight Carried s Tonne") FROM table_80057 WHERE "Road Closed" = 'march 31' AND "Super B Capacity Reached [ citation needed ]" = 'february 17' AND "Year" > '2011'
### Instruction: provide the number of patients whose ethnicity is black/cape verdean and drug code is docu100? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND prescriptions.formulary_drug_cd = "DOCU100"
### Instruction: Out of total number of patients admitted before the year 2150, how many of them were treated with dabigatran etexilate? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admityear < "2150" AND prescriptions.drug = "Dabigatran Etexilate"
### Instruction: Find the dates of assessment notes for students with first name 'Fanny', and count them by a bar chart, and I want to display by the y axis from low to high. ### Response:
SELECT date_of_notes, COUNT(date_of_notes) FROM Assessment_Notes AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.first_name = "Fanny" ORDER BY COUNT(date_of_notes)
### Instruction: provide the number of patients who have the admission location as transfer from hosp/extram and diagnosis icd9 code as 4820. ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND diagnoses.icd9_code = "4820"
### Instruction: A pie chart showing the number of browsers for each accelerator in the descending order of compatible year. ### Response:
SELECT T3.name, COUNT(T3.name) FROM accelerator_compatible_browser AS T1 JOIN browser AS T2 ON T1.browser_id = T2.id JOIN Web_client_accelerator AS T3 ON T1.accelerator_id = T3.id GROUP BY T3.name ORDER BY T1.compatible_since_year DESC
### Instruction: For those employees who do not work in departments with managers that have ids between 100 and 200, find email and salary , and visualize them by a bar chart, and list in ascending by the bars. ### Response:
SELECT EMAIL, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY EMAIL
### Instruction: What was the average number of people born in other EU states in millions, when the total number of foreign-born people in millions was 0.5, and when the total population in millions was less than 5.534? ### Response:
SELECT AVG(born_in_other_eu_state__millions_) FROM table_name_57 WHERE total_foreign_born__millions_ = 0.5 AND total_population__millions_ < 5.534
### Instruction: For those employees who did not have any job in the past, a bar chart shows the distribution of hire_date and the sum of department_id bin hire_date by weekday, and could you order from low to high by the sum department id? ### Response:
SELECT HIRE_DATE, SUM(DEPARTMENT_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY SUM(DEPARTMENT_ID)
### Instruction: what topics does Luke Zettlemoyer publish in ### Response:
SELECT DISTINCT keyphrase.keyphraseid FROM author, keyphrase, paper, paperkeyphrase, writes WHERE author.authorname = 'Luke Zettlemoyer' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid AND writes.authorid = author.authorid AND writes.paperid = paper.paperid
### Instruction: What rider has laps less than 20, a ducati 1098 rs 08 as the bike, with accident as the time, and a grid less than 14? ### Response:
SELECT "Rider" FROM table_64321 WHERE "Laps" < '20' AND "Bike" = 'ducati 1098 rs 08' AND "Time" = 'accident' AND "Grid" < '14'
### Instruction: what is the number of patients whose admission location is clinic referral/premature and lab test name is reticulocyte count, manual? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND lab.label = "Reticulocyte Count, Manual"
### Instruction: Which Torque Nm@rpm has a Power kW@rpm equal to 184 @ 2500 and a GVM (kg) Technical Capacity of 16000? ### Response:
SELECT "Torque Nm@rpm" FROM table_54074 WHERE "Power kW@rpm" = '184 @ 2500' AND "GVM (kg) Technical Capacity" = '16000'
### Instruction: provide the number of patients whose days of hospital stay is greater than 0 and diagnoses long title is asthma, unspecified type, unspecified? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "0" AND diagnoses.long_title = "Asthma, unspecified type, unspecified"
### Instruction: how many american indian/alaska native ethnic background patients have diagnoses icd9 code 59654? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND diagnoses.icd9_code = "59654"
### Instruction: how many patients whose diagnoses short title is pyelonephritis nos and lab test abnormal status is delta? ### 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 = "Pyelonephritis NOS" AND lab.flag = "delta"
### Instruction: count the number of patients who have received a microbiological eye test since 2 years ago. ### Response:
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT microbiologyevents.hadm_id FROM microbiologyevents WHERE microbiologyevents.spec_type_desc = 'eye' AND DATETIME(microbiologyevents.charttime) >= DATETIME(CURRENT_TIME(), '-2 year'))
### Instruction: For those employees who did not have any job in the past, show me about the distribution of job_id and the average of salary , and group by attribute job_id in a bar chart, and rank by the total number in ascending. ### Response:
SELECT JOB_ID, AVG(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY AVG(SALARY)
### Instruction: count the number of patients whose admission type is emergency and drug name is sulfameth/trimethoprim suspension? ### 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 = "Sulfameth/Trimethoprim Suspension"
### Instruction: For all employees who have the letters D or S in their first name, draw a bar chart about the distribution of hire_date and the average of manager_id bin hire_date by weekday, show by the the average of manager id in descending. ### Response:
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY AVG(MANAGER_ID) DESC
### Instruction: How many of next semester 's classes will be HMP ? ### Response:
SELECT COUNT(DISTINCT course_offering.course_id) FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'HMP' AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016
### Instruction: Name the courses in Digital Studio 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 '%Digital Studio%' OR course.description LIKE '%Digital Studio%' OR course.name LIKE '%Digital Studio%') AND program_course.category LIKE '%MDE%'
### Instruction: For those employees who did not have any job in the past, visualize a bar chart about the distribution of job_id and the average of department_id , and group by attribute job_id, and could you list bars in descending order? ### Response:
SELECT JOB_ID, AVG(DEPARTMENT_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY JOB_ID DESC
### Instruction: provide the number of patients whose insurance is self pay and procedure long title is initial insertion of transvenous lead [electrode] into ventricle? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Self Pay" AND procedures.long_title = "Initial insertion of transvenous lead [electrode] into ventricle"
### Instruction: Which tourist attractions does the visitor with detail 'Vincent' visit? ### Response:
SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID JOIN VISITORS AS T3 ON T2.Tourist_ID = T3.Tourist_ID WHERE T3.Tourist_Details = "Vincent"
### Instruction: How many surfaces were played on in 2005 where the score was 6 7 (4 7) , 3 6, 7 6 (7 2) , 3 6? ### Response:
SELECT COUNT("Surface") FROM table_2082 WHERE "Year" = '2005' AND "Score" = '6–7 (4–7) , 3–6, 7–6 (7–2) , 3–6'
### Instruction: when first patient 006-21143 was discharged from the hospital in the last year? ### Response:
SELECT patient.hospitaldischargetime FROM patient WHERE patient.uniquepid = '006-21143' AND DATETIME(patient.hospitaldischargetime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY patient.hospitaldischargetime LIMIT 1
### Instruction: Which Gain is the lowest one that has a Loss larger than 2, and an Avg/G larger than -6, and a Name of sheehan, tyler, and a Long larger than 11? ### Response:
SELECT MIN("Gain") FROM table_37487 WHERE "Loss" > '2' AND "Avg/G" > '-6' AND "Name" = 'sheehan, tyler' AND "Long" > '11'
### Instruction: Which courses are there this semester ? ### Response:
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND semester.semester = 'WN' AND semester.semester_id = course_offering.semester AND semester.year = 2016 ORDER BY course.department
### Instruction: what is the total number of patients who had brain mass, intracranial hemorrhage as primary disease and had a lab test for ascites? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "BRAIN MASS;INTRACRANIAL HEMORRHAGE" AND lab.fluid = "Ascites"
### Instruction: For those records from the products and each product's manufacturer, show me about the distribution of headquarter and the sum of code , and group by attribute headquarter in a bar chart, display by the Headquarter in ascending. ### Response:
SELECT T2.Headquarter, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Headquarter ORDER BY T2.Headquarter