instruction
stringlengths
53
549
output
stringlengths
30
2.33k
### Instruction: did patient 015-100195 come into an er in 2105? ### Response:
SELECT COUNT(*) > 0 FROM patient WHERE patient.uniquepid = '015-100195' AND patient.hospitaladmitsource = 'emergency department' AND STRFTIME('%y', patient.unitadmittime) = '2105'
### Instruction: what is the number of patients whose admission type is emergency and item id is 51300? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND lab.itemid = "51300"
### Instruction: What is the release date of the episode named Mouse-Placed Kitten with an episode number less than 1495 directed by Robert McKimson? ### Response:
SELECT "Release date" FROM table_65141 WHERE "Production Number" < '1495' AND "Director" = 'robert mckimson' AND "Title" = 'mouse-placed kitten'
### Instruction: provide the number of patients whose marital status is married and procedure long title is other transplant of liver? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "MARRIED" AND procedures.long_title = "Other transplant of liver"
### Instruction: What is the Catalog when the format is ed remaster cd, and a Label of village records, and a Date of march 13, 2002? ### Response:
SELECT "Catalog" FROM table_7666 WHERE "Format" = 'ed remaster cd' AND "Label" = 'village records' AND "Date" = 'march 13, 2002'
### Instruction: What is the total number of First Elected that has counties represented of Anne Arundel, District of 30, and a Ways and Means Committee? ### Response:
SELECT COUNT("First Elected") FROM table_71330 WHERE "Counties Represented" = 'anne arundel' AND "District" = '30' AND "Committee" = 'ways and means'
### Instruction: Show the pair of male and female names in all weddings after year 2014 ### Response:
SELECT T2.name, T3.name FROM wedding AS T1 JOIN people AS T2 ON T1.male_id = T2.people_id JOIN people AS T3 ON T1.female_id = T3.people_id WHERE T1.year > 2014
### Instruction: what paper has Clifford Grobstein published in Science ? ### Response:
SELECT DISTINCT paper.paperid FROM author, paper, venue, writes WHERE author.authorname = 'Clifford Grobstein' AND venue.venueid = paper.venueid AND venue.venuename = 'Science' AND writes.authorid = author.authorid AND writes.paperid = paper.paperid
### Instruction: what is the number of patients admitted in hospital before 2180 who had albumin, pleural lab test? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2180" AND lab.label = "Albumin, Pleural"
### Instruction: For those employees who was hired before 2002-06-21, draw a bar chart about the distribution of hire_date and the average of employee_id bin hire_date by weekday. ### Response:
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE HIRE_DATE < '2002-06-21'
### Instruction: What was the team from Austria when the Netherlands sent Brunssum/Schinnen LL Brunssum and Belgium sent Shape and Waterloo LL Brussels? ### Response:
SELECT austria FROM table_28562675_3 WHERE netherlands = "Brunssum/Schinnen LL Brunssum" AND belgium = "SHAPE and Waterloo LL Brussels"
### Instruction: what is the number of patients whose drug route is tp and admission year is before 2167? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admityear < "2167" AND prescriptions.route = "TP"
### Instruction: what is the number of patients whose discharge location is disch-tran to psych hosp and admission year is less than 2145? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "DISCH-TRAN TO PSYCH HOSP" AND demographic.admityear < "2145"
### Instruction: what is the number of government health insurance patients who are diagnosed with microscopic hematuria? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Government" AND diagnoses.long_title = "Microscopic hematuria"
### Instruction: What is the percent change (1990 2000) when the 2007 estimate is 0 1,598,161? ### Response:
SELECT "Percent Change (1990\u20132000)" FROM table_543 WHERE "2007 Estimate" = '0 1,598,161'
### Instruction: What is the to par of the player from the United States with a t6 place and a score of 70-73-68-73=284? ### Response:
SELECT to_par FROM table_name_22 WHERE country = "united states" AND place = "t6" AND score = 70 - 73 - 68 - 73 = 284
### Instruction: what's the thursday time with sunday being 1:00-5:00 and tuesday being 1:00-7:00 ### Response:
SELECT thursday FROM table_11019212_1 WHERE sunday = "1:00-5:00" AND tuesday = "1:00-7:00"
### Instruction: among patients aged below 86, how many of them had rt & lt heart angiocard? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "86" AND procedures.short_title = "Rt & lt heart angiocard"
### Instruction: For each room, find its name and the number of times reservations were made for it, you can use the data to draw a bar chart, could you display by the the total number in desc please? ### Response:
SELECT roomName, COUNT(*) FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room ORDER BY COUNT(*) DESC
### Instruction: What are recent papers on Visual Detection ? ### Response:
SELECT DISTINCT paper.paperid, paper.year FROM keyphrase, paper, paperkeyphrase WHERE keyphrase.keyphrasename = 'Visual Detection' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid ORDER BY paper.year DESC
### Instruction: how many patients whose discharge location is snf and procedure icd9 code is 8960? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "SNF" AND procedures.icd9_code = "8960"
### Instruction: give me the number of patients whose primary disease is rash and the procedure icd9 code is 5091. ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "RASH" AND procedures.icd9_code = "5091"
### Instruction: When 380 g/mi (236 g/km) is the dirty electric grid rocky mountains (denver) what is the u.s national average electric mix? ### Response:
SELECT "U.S. national average electric mix" FROM table_27012 WHERE "Dirty electric grid Rocky Mountains (Denver)" = '380 g/mi (236 g/km)'
### Instruction: how many patients with infected right thigh graft were of american indian/alaska native ethnicty? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND demographic.diagnosis = "INFECTED RIGHT THIGH GRAFT"
### Instruction: out of the total number of patients admitted to emergency, how many had item id 50809? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND lab.itemid = "50809"
### Instruction: show me patient 62298's los of the last hospital stay. ### Response:
SELECT STRFTIME('%j', admissions.dischtime) - STRFTIME('%j', admissions.admittime) FROM admissions WHERE admissions.subject_id = 62298 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1
### Instruction: What are the locations that have gas stations owned by a company with a market value greater than 100? ### Response:
SELECT T3.location FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id WHERE T2.market_value > 100
### Instruction: Bldr of mcw&f, and a Year smaller than 1927, and a LT Nos of 9820-9821 has what type? ### Response:
SELECT type FROM table_name_19 WHERE bldr = "mcw&f" AND year < 1927 AND lt_nos = "9820-9821"
### Instruction: with catholic of 3.33% and total population more than 1,528,384,440, what is the % global catholic pop.? ### Response:
SELECT "% of global Catholic pop." FROM table_35368 WHERE "Total Population" > '1,528,384,440' AND "% Catholic" = '3.33%'
### Instruction: count the number of patients whose admission type is newborn and lab test item id is 51276. ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "NEWBORN" AND lab.itemid = "51276"
### Instruction: What are all the states (class) when the reason for change was resigned November 26, 1798 and the vacator was John Hunter ( DR )? ### Response:
SELECT "State (class)" FROM table_73398 WHERE "Reason for change" = 'Resigned November 26, 1798' AND "Vacator" = 'John Hunter ( DR )'
### Instruction: Which teachers teach the student named EVELINA BROMLEY? Give me the first and last name of the teachers. ### Response:
SELECT T2.firstname, T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = "EVELINA" AND T1.lastname = "BROMLEY"
### Instruction: Total number of questions tagged python. ### Response:
SELECT Tags.TagName, PostTags.PostId, Posts.OwnerUserId, Votes.VoteTypeId FROM Tags INNER JOIN PostTags ON Tags.Id = PostTags.TagId INNER JOIN Posts ON PostTags.PostId = Posts.Id INNER JOIN Votes ON Posts.Id = Votes.PostId WHERE Tags.TagName = 'python'
### Instruction: count the number of patients on po/ng route of drug administration who have hemoptysis primary disease. ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.diagnosis = "HEMOPYTSIS" AND prescriptions.route = "PO/NG"
### Instruction: In year 2011 what is sum of profit/loss before tax and net profit larger than 123.8 million? ### Response:
SELECT COUNT("Profit/(loss) before tax (\u00a3m)") FROM table_50332 WHERE "Year ended" = '2011' AND "Net profit (\u00a3m)" > '123.8'
### Instruction: has patient 18223 had any procedure on their first hospital encounter? ### Response:
SELECT COUNT(*) > 0 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 18223 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1)
### Instruction: Find the names of all the clubs that have at least a member from the city with city code 'BAL'. ### Response:
SELECT DISTINCT t1.clubname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.city_code = "BAL"
### Instruction: What is the Canadian Kennel Club Toy Dogs Group with the australian silky terrier as the Australian National Kennel Council Toy Dogs Group breed? ### Response:
SELECT canadian_kennel_club_toy_dogs_group FROM table_name_49 WHERE australian_national_kennel_council_toy_dogs_group = "australian silky terrier"
### Instruction: give me a 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
### Instruction: How many Touchdowns have a rec of 10, and an Opponent of oregon state, and an Average smaller than 19.7? ### Response:
SELECT COUNT("s Touchdown") FROM table_35033 WHERE "Rec." = '10' AND "Opponent" = 'oregon state' AND "Average" < '19.7'
### Instruction: What 2010 has a 2006 less than 6.9, a 2008 greater than 1.6, and 2 for 2007? ### Response:
SELECT 2010 FROM table_name_21 WHERE 2006 < 6.9 AND 2008 > 1.6 AND 2007 = 2
### Instruction: how did patient 007-3099 first be admitted to the hospital since 2105? ### Response:
SELECT patient.hospitaladmitsource FROM patient WHERE patient.uniquepid = '007-3099' AND STRFTIME('%y', patient.hospitaladmittime) >= '2105' ORDER BY patient.hospitaladmittime LIMIT 1
### Instruction: give me the number of patients whose age is less than 77 and lab test name is renal epithelial cells? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "77" AND lab.label = "Renal Epithelial Cells"
### Instruction: What's the total of 1988-89 that has a 1986-87 of 38, and Points that's smaller than 109? ### Response:
SELECT SUM("1988-89") FROM table_34034 WHERE "1986-87" = '38' AND "Points" < '109'
### Instruction: how many patients until 2104 were staying at ward 28? ### Response:
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT transfers.hadm_id FROM transfers WHERE transfers.wardid = 28 AND STRFTIME('%y', transfers.intime) <= '2104')
### Instruction: For all employees who have the letters D or S in their first name, give me the trend about commission_pct over hire_date , and I want to rank x axis from low to high order. ### Response:
SELECT HIRE_DATE, COMMISSION_PCT FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY HIRE_DATE
### Instruction: which has the same wg as systems and software engineering - system life cycle processes ? ### Response:
SELECT "title" FROM table_204_200 WHERE "title" <> 'systems and software engineering - system life cycle processes' AND "wg" = (SELECT "wg" FROM table_204_200 WHERE "title" = 'systems and software engineering - system life cycle processes')
### Instruction: give me the number of patients whose insurance is self pay and diagnoses icd9 code is 431? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Self Pay" AND diagnoses.icd9_code = "431"
### Instruction: how many patients of white ethnicty were diagnosed under icd9 code 7069? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "WHITE" AND diagnoses.icd9_code = "7069"
### Instruction: how many patients had the diagnosis long title hemochromatosis due to repeated red blood cell transfusions? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.long_title = "Hemochromatosis due to repeated red blood cell transfusions"
### Instruction: what is the number of patients whose admission year is less than 2150 and lab test name is free calcium? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2150" AND lab.label = "Free Calcium"
### Instruction: A bar chart showing the number of films each cinema has, order Y-axis from low to high order. ### Response:
SELECT Name, COUNT(Name) FROM schedule AS T1 JOIN film AS T2 ON T1.Film_ID = T2.Film_ID JOIN cinema AS T3 ON T1.Cinema_ID = T3.Cinema_ID GROUP BY Name ORDER BY COUNT(Name)
### Instruction: What is Rating, when Air Date is 'July 24, 2008*', and when Weekly Winner is 'Sales Rep. Oscar Ledezma'? ### Response:
SELECT rating FROM table_name_7 WHERE air_date = "july 24, 2008*" AND weekly_winner = "sales rep. oscar ledezma"
### Instruction: how many patients with malnutrition of mild degree stayed in the hospital for more than a day? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "1" AND diagnoses.short_title = "Malnutrition mild degree"
### Instruction: For those employees who was hired before 2002-06-21, show me about the distribution of job_id and the sum of salary , and group by attribute job_id in a bar chart. ### Response:
SELECT JOB_ID, SUM(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID
### Instruction: what number of patients of episcopalian religion had lab test item id 51497? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.religion = "EPISCOPALIAN" AND lab.itemid = "51497"
### Instruction: select Title, CreationDate from Posts. ### Response:
SELECT Title FROM Tags, PostTags, Posts, PostTypes WHERE CreationDate <= '2014-10-31' AND Tags.Id = PostTags.TagId AND PostId = Posts.Id AND TagName = 'java' AND Posts.PostTypeId = 1 AND Posts.PostTypeId = PostTypes.Id
### Instruction: how many patients below 77 years of age have had the procedure with short title radiotherapeutic proc nec? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "77" AND procedures.short_title = "Radiotherapeut proc NEC"
### Instruction: What have you tried so far?' Comments. ### Response:
SELECT C.PostId AS "post_link", C.Id AS "comment_link", C.CreationDate, C.UserId AS "user_link" FROM Comments AS C WHERE REPLACE(UPPER(C.Text), ' ', '') = 'WHATHAVEYOUTRIEDSOFAR?' ORDER BY C.CreationDate DESC
### Instruction: give me the number of patients whose year of birth is less than 2121 and lab test fluid is other body fluid? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2121" AND lab.fluid = "Other Body Fluid"
### Instruction: what is the number of patients whose age is less than 86 and procedure short title is endosc destruc esoph les? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "86" AND procedures.short_title = "Endosc destruc esoph les"
### Instruction: what is the lowest 2011 for sunway lagoon water park and 2012 is less than 1,200,000? ### Response:
SELECT MIN("2011") FROM table_46890 WHERE "Water park" = 'sunway lagoon' AND "2012" < '1,200,000'
### Instruction: Which men's singles has a women's singles of marketa koudelkov as well as a Men's doubles of jan lanik / pavel weigner?? ### Response:
SELECT "Men's singles" FROM table_43144 WHERE "Women's singles" = 'marketa koudelková' AND "Men's doubles" = 'jan lanik / pavel weigner'
### Instruction: what is the number of patients admitted on emergency basis who have lab test item id 50927? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND lab.itemid = "50927"
### Instruction: provide the number of patients whose death status is 1 and diagnoses icd9 code is 317. ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "1" AND diagnoses.icd9_code = "317"
### Instruction: What are the payment date of the payment with amount paid higher than 300 or with payment type is 'Check, and count them by a line chart, and show X from high to low order. ### Response:
SELECT payment_date, COUNT(payment_date) FROM Payments WHERE amount_paid > 300 OR payment_type_code = 'Check' GROUP BY payment_date ORDER BY payment_date DESC
### Instruction: Name the married filing jointly or qualified widow(er) with head of household being $117,451 $190,200 ### Response:
SELECT married_filing_jointly_or_qualified_widow_er_ FROM table_name_61 WHERE head_of_household = "$117,451–$190,200"
### Instruction: What is the proportion of job titles for employees in department 80? You can give me a pie chart. ### Response:
SELECT JOB_TITLE, COUNT(JOB_TITLE) FROM employees AS T1 JOIN jobs AS T2 ON T1.JOB_ID = T2.JOB_ID WHERE T1.DEPARTMENT_ID = 80 GROUP BY JOB_TITLE
### Instruction: What is the last name of the student who got a grade A in the class with code 10018. ### Response:
SELECT T1.stu_lname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE T2.enroll_grade = 'A' AND T2.class_code = 10018
### Instruction: For those employees who did not have any job in the past, return a line chart about the change of employee_id over hire_date , show by the X from high to low. ### Response:
SELECT HIRE_DATE, EMPLOYEE_ID FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY HIRE_DATE DESC
### Instruction: What is the name of the Leftfielder when the Shortstop was bill russell, and the Second Baseman was steve sax in 1983? ### Response:
SELECT "Leftfielder" FROM table_70750 WHERE "Shortstop" = 'bill russell' AND "Second Baseman" = 'steve sax' AND "Year" = '1983'
### Instruction: Most popular tags in last year. ### Response:
SELECT TagName, COUNT(PostId) AS Rate FROM Tags, PostTags, Posts WHERE Tags.Id = PostTags.TagId AND Posts.Id = PostId AND YEAR(Posts.CreationDate) >= 2019 GROUP BY TagName HAVING COUNT(PostId) > 10000 ORDER BY Rate DESC
### Instruction: how many patients are born before 2182 and suggested with drug route via iv bolus? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "2182" AND prescriptions.route = "IV BOLUS"
### Instruction: Rate of accepted answers for the site. ### Response:
SELECT COUNT(q.Id), COUNT(q2.Id), ROUND(COUNT(q2.Id) * 100 / COUNT(q.Id), 2) FROM Posts AS q LEFT JOIN Posts AS q2 ON q.Id = q2.Id AND q.AnswerCount > 0 WHERE q.PostTypeId = 1
### Instruction: count the number of patients whose admission type is emergency and drug route is buccal? ### 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.route = "BUCCAL"
### Instruction: Who was the race winner with a pole position james hunt, and a Fastest Lap of james hunt, and a Date of 15 august? ### Response:
SELECT "Race Winner" FROM table_56239 WHERE "Pole Position" = 'james hunt' AND "Fastest Lap" = 'james hunt' AND "Date" = '15 august'
### Instruction: What are the first names of the different drivers who won in position 1 as driver standing and had more than 20 points? ### Response:
SELECT DISTINCT T1.forename FROM drivers AS T1 JOIN driverstandings AS T2 ON T1.driverid = T2.driverid WHERE T2.position = 1 AND T2.wins = 1 AND T2.points > 20
### Instruction: count the number of patients whose admission year is less than 2150 and lab test name is cortisol? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2150" AND lab.label = "Cortisol"
### Instruction: Find the distinct student first names of all students that have grade point at least 3.8 in one course. ### Response:
SELECT DISTINCT T3.fname FROM enrolled_in AS T1 JOIN gradeconversion AS T2 JOIN student AS T3 ON T1.grade = T2.lettergrade AND T1.stuid = T3.stuid WHERE T2.gradepoint >= 3.8
### Instruction: the london emirates air line pylon has the same height as which pylon ? ### Response:
SELECT "name" FROM table_203_375 WHERE "name" <> 'london emirates air line' AND "height" = (SELECT "height" FROM table_203_375 WHERE "name" = 'london emirates air line')
### Instruction: report the number of elective hospital admission patients who had percutaneous aspiration of liver. ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND procedures.long_title = "Percutaneous aspiration of liver"
### Instruction: Which room has the highest rate? List the room's full name, rate, check in and check out date. ### Response:
SELECT T2.roomname, T1.rate, T1.checkin, T1.checkout FROM reservations AS T1 JOIN rooms AS T2 ON T1.room = T2.roomid GROUP BY T1.room ORDER BY T1.rate DESC LIMIT 1
### Instruction: What is the 1985 value for the year when GDP as of 2012 after PPP was 369.38? ### Response:
SELECT "1985" FROM table_31522 WHERE "GDP as of 2012 after purchasing power parity (PPP) calculations (USD billions)" = '369.38'
### Instruction: count the number of patients whose gender is f and drug code is love40i? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.gender = "F" AND prescriptions.formulary_drug_cd = "LOVE40I"
### Instruction: What was the 1989 result for the tournament with 1984 of a, 1985 of a, and 1990 of a? ### Response:
SELECT "1989" FROM table_46599 WHERE "1984" = 'a' AND "1985" = 'a' AND "1990" = 'a'
### Instruction: Draw a bar chart for how many stores are headquarted in each city? ### Response:
SELECT Headquartered_City, COUNT(*) FROM store AS t1 JOIN store_district AS t2 ON t1.Store_ID = t2.Store_ID JOIN district AS t3 ON t2.District_ID = t3.District_ID GROUP BY t3.Headquartered_City
### Instruction: Provide me the number of patients who stayed in the hospital for more than 27 days that had a magnesium lab test. ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "27" AND lab.label = "Magnesium"
### Instruction: how many patients whose admission type is elective and procedure short title is incision of aorta? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND procedures.short_title = "Incision of aorta"
### Instruction: how many patients diagnosed with delirium due to conditions classified elsewhere are still alive? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "0" AND diagnoses.long_title = "Delirium due to conditions classified elsewhere"
### Instruction: For each nomination, show the name of the artwork and name of the festival where it is nominated. ### Response:
SELECT T2.Name, T3.Festival_Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID
### Instruction: What is the air wing for the craft with a tail code of ah-3xx, deployed from 16 June 1967 in the Vietnam War? ### Response:
SELECT "air wing" FROM table_46314 WHERE "area" = 'vietnam war' AND "tail code" = 'ah-3xx' AND "from" = '16 june 1967'
### Instruction: Find the id of suppliers whose average amount purchased for each product is above 50000 or below 30000. ### Response:
SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id HAVING AVG(total_amount_purchased) > 50000 OR AVG(total_amount_purchased) < 30000
### Instruction: provide the number of patients whose admission type is urgent and drug type is additive? ### 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_type = "ADDITIVE"
### Instruction: Return the booking start date and end date for the apartments that have type code 'Duplex'. ### Response:
SELECT T1.booking_start_date, T1.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"
### Instruction: What Object Type has a 21h01m37.7s Right Ascension (J2000) and 6995 or greater NGC? ### Response:
SELECT object_type FROM table_name_81 WHERE ngc_number > 6995 AND right_ascension___j2000__ = "21h01m37.7s"
### Instruction: how many patients whose age is less than 31 and diagnoses icd9 code is v140? ### 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.icd9_code = "V140"
### Instruction: Find the names of the clubs that have at least a member from the city with city code 'HOU'. ### Response:
SELECT DISTINCT t1.clubname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.city_code = "HOU"
### Instruction: Users with a silver badge but not a bronze badge. ### Response:
SELECT DISTINCT (u.Id) AS "user_link" FROM Users AS u INNER JOIN Badges AS sb ON sb.UserId = u.Id AND sb.Class = 2 LEFT JOIN Badges AS bb ON bb.UserId = u.Id AND bb.Class = 3 WHERE bb.Id IS NULL
### Instruction: Users got the most downs. ### Response:
SELECT Posts.OwnerUserId AS "user_link", COUNT(*) AS Count FROM Posts, Votes WHERE Posts.Id = Votes.PostId AND Votes.VoteTypeId = 3 AND Posts.OwnerUserId > 0 GROUP BY Posts.OwnerUserId ORDER BY Count DESC, Posts.OwnerUserId LIMIT 100
### Instruction: count the number of patients whose gender is m and diagnoses short title is pseudomonas infect nos? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "M" AND diagnoses.short_title = "Pseudomonas infect NOS"