instruction
stringlengths
53
549
output
stringlengths
30
2.33k
### Instruction: count the number of patients whose age is less than 71 and item id is 50856? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "71" AND lab.itemid = "50856"
### Instruction: count the number of patients whose age is less than 58 and procedure long title is hemodialysis? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "58" AND procedures.long_title = "Hemodialysis"
### Instruction: For those payments processed with Visa, bin the payment day into Year interval and count them for a bar chart, order from high to low by the y axis. ### Response:
SELECT Date_Payment_Made, COUNT(Date_Payment_Made) FROM Payments WHERE Payment_Method_Code = 'Visa' ORDER BY COUNT(Date_Payment_Made) DESC
### Instruction: find the number of patients admitted before 2151 who had ascitic fluid lab test. ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2151" AND lab.fluid = "Ascites"
### Instruction: count the number of patients whose discharge location is left against medical advi and year of birth is less than 2150? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "LEFT AGAINST MEDICAL ADVI" AND demographic.dob_year < "2150"
### Instruction: when was the last time patient 76637 was discharged since 2102? ### Response:
SELECT admissions.dischtime FROM admissions WHERE admissions.subject_id = 76637 AND STRFTIME('%y', admissions.dischtime) >= '2102' ORDER BY admissions.dischtime DESC LIMIT 1
### Instruction: For those employees who did not have any job in the past, give me the comparison about the average of manager_id over the hire_date bin hire_date by weekday. ### Response:
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
### Instruction: What is Party, when District is less than 10, when Took Office is less than 1991, and when Home Town is Mount Pleasant? ### Response:
SELECT "Party" FROM table_47118 WHERE "District" < '10' AND "Took Office" < '1991' AND "Home Town" = 'mount pleasant'
### Instruction: Display a pie chart for what are the names and ids of the tourist attractions that are visited at most once? ### Response:
SELECT T1.Name, T1.Tourist_Attraction_ID FROM Tourist_Attractions AS T1 JOIN Visits AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID
### Instruction: give me the number of patients admitted before 2124 with clinic referral/premature as admission location. ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND demographic.admityear < "2124"
### Instruction: provide the number of patients whose insurance is government and lab test name is wbc, joint fluid? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.insurance = "Government" AND lab.label = "WBC, Joint Fluid"
### Instruction: Which Seats have a Share of votes of 18%, and a Share of seats of 3%, and a General election larger than 1992? ### Response:
SELECT MAX(seats) FROM table_name_62 WHERE share_of_votes = "18%" AND share_of_seats = "3%" AND general_election > 1992
### Instruction: Most viewed question where I have an answer. ### Response:
SELECT p1.Id, p1.Title, p1.ViewCount FROM Posts AS p JOIN Posts AS p1 ON P.ParentId = p1.Id WHERE p.OwnerUserId = '##UserId##' AND p.PostTypeId = 2 ORDER BY p1.ViewCount DESC LIMIT 100
### Instruction: what is the number of patients whose marital status is divorced and lab test name is other cells? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "DIVORCED" AND lab.label = "Other Cells"
### Instruction: For all employees who have the letters D or S in their first name, return a bar chart about the distribution of hire_date and the sum of employee_id bin hire_date by time. ### Response:
SELECT HIRE_DATE, SUM(EMPLOYEE_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%'
### Instruction: What is the smallest number of goals for the player from 2008-present named tony beltran, ranked lower than 7? ### Response:
SELECT MIN("Goals") FROM table_32628 WHERE "Years" = '2008-present' AND "Player" = 'tony beltran' AND "Rank" > '7'
### Instruction: what is the days of hospital stay and icu stay id of the patient id 81254? ### Response:
SELECT demographic.days_stay, prescriptions.icustay_id FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.subject_id = "81254"
### Instruction: Find each target user's name and average trust score Visualize by bar chart, rank y axis from low to high order. ### Response:
SELECT name, AVG(trust) FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id = T2.target_u_id GROUP BY T2.target_u_id ORDER BY AVG(trust)
### Instruction: give me the number of patients whose age is less than 41 and lab test category is blood gas? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "41" AND lab."CATEGORY" = "Blood Gas"
### Instruction: gg test of poorly answer questions for apps. ### Response:
SELECT * FROM Posts WHERE AnswerCount > 5 AND CommentCount > 5 AND ViewCount > 50 AND CommunityOwnedDate IS NULL AND ClosedDate IS NULL AND AcceptedAnswerId IS NULL AND Tags LIKE '%##Tag1##%' AND CreationDate > '2015-12-21'
### Instruction: For those records from the products and each product's manufacturer, show me about the distribution of name and price , and group by attribute name in a bar chart. ### Response:
SELECT T1.Name, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name, T1.Name
### Instruction: what is the number of medicaid insurance patients who have undergone hemodialysis? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Medicaid" AND procedures.long_title = "Hemodialysis"
### 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 sum of employee_id bin hire_date by time. ### Response:
SELECT HIRE_DATE, SUM(EMPLOYEE_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%'
### Instruction: How many points numbers had a class of 250cc, a year prior to 1978, Yamaha as a team, and where wins was more than 0? ### Response:
SELECT COUNT(points) FROM table_name_19 WHERE class = "250cc" AND year < 1978 AND team = "yamaha" AND wins > 0
### Instruction: Tell me the sum of number of jamaicans given british citizenship for 2004 and registration of a minor child more than 640 ### Response:
SELECT SUM("Numer of Jamaicans granted British citizenship") FROM table_53158 WHERE "Year" = '2004' AND "Registration of a minor child" > '640'
### Instruction: Search comments for given string on others' posts. ### Response:
SELECT c.Id AS "comment_link", u.DisplayName FROM Comments AS c FULL OUTER JOIN Posts AS p ON c.PostId = p.Id JOIN Users AS u ON u.Id = p.OwnerUserId WHERE u.Id != '##Userid##' AND Text LIKE '##SearchString##'
### Instruction: provide the number of patients whose ethnicity is black/african american and year of birth is less than 2123? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "BLACK/AFRICAN AMERICAN" AND demographic.dob_year < "2123"
### Instruction: when did patient 15107 enter for the first time in the hospital since 2104? ### Response:
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 15107 AND STRFTIME('%y', admissions.admittime) >= '2104' ORDER BY admissions.admittime LIMIT 1
### Instruction: count the number of patients whose insurance is private and procedure short title is oth cardiac mon output? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Private" AND procedures.short_title = "Oth cardiac mon output"
### Instruction: What is the customer id, first and last name with most number of accounts. ### Response:
SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name FROM accounts AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) DESC LIMIT 1
### Instruction: count the number of patients whose item id is 50801 and lab test abnormal status is abnormal? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "50801" AND lab.flag = "abnormal"
### Instruction: Find the names of schools that have more than one donator with donation amount above 8.5. ### Response:
SELECT T2.school_name FROM endowment AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id WHERE T1.amount > 8.5 GROUP BY T1.school_id HAVING COUNT(*) > 1
### Instruction: Undeleted posts by a user. ### Response:
SELECT p.Id AS "post_link" FROM Posts AS p INNER JOIN PostHistory AS e ON e.PostId = p.Id WHERE e.PostHistoryTypeId = 13 AND p.OwnerUserId = '##userid##' GROUP BY p.Id, p.CreationDate ORDER BY p.CreationDate DESC
### Instruction: how many first elected with result being re-elected and incumbent being gary ackerman redistricted from the 7th district ### Response:
SELECT COUNT(first_elected) FROM table_1341549_33 WHERE result = "Re-elected" AND incumbent = "Gary Ackerman Redistricted from the 7th district"
### Instruction: find me paper on using Neural for Relation Extraction ### Response:
SELECT DISTINCT paperkeyphrase.paperid FROM keyphrase, paperkeyphrase WHERE keyphrase.keyphrasename IN ('Neural', 'Relation Extraction') GROUP BY paperkeyphrase.paperid HAVING COUNT(DISTINCT keyphrase.keyphraseid) = 1
### Instruction: Name the Company which has a Tracking Method of cookies via javascript, and a Latest stable release of n/a, and a Name of clicktale? ### Response:
SELECT "Company" FROM table_8264 WHERE "Tracking Method" = 'cookies via javascript' AND "Latest stable release" = 'n/a' AND "Name" = 'clicktale'
### Instruction: Find the number of the name of rooms booked by some customers whose first name contains ROY, and show Y in asc order. ### Response:
SELECT roomName, COUNT(roomName) FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE FirstName LIKE '%ROY%' GROUP BY roomName ORDER BY COUNT(roomName)
### Instruction: provide the number of patients whose admission location is transfer from hosp/extram and admission year is less than 2131? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND demographic.admityear < "2131"
### Instruction: What is the Status for the District of doncaster, and a Former local authority of doncaster rural district, with a Population of 203? ### Response:
SELECT "Status" FROM table_34722 WHERE "District" = 'doncaster' AND "Former local authority" = 'doncaster rural district' AND "Population" = '203'
### Instruction: give me a good restaurant on bethel island rd in bethel island ? ### Response:
SELECT location.house_number, restaurant.name FROM location, restaurant WHERE location.city_name = 'bethel island' AND location.street_name = 'bethel island rd' AND restaurant.id = location.restaurant_id AND restaurant.rating > 2.5
### Instruction: What is the average rating of viewers 18 to 49 where the total viewer count is 3.93 million and share less than 4? ### Response:
SELECT AVG("18\u201349") FROM table_51322 WHERE "Viewers (m)" = '3.93' AND "Share" < '4'
### Instruction: What is the class of the locomotive with an Eastleigh Works manufacturer, made in 1914, and withdrawn in 1959? ### Response:
SELECT class FROM table_name_72 WHERE manufacturer = "eastleigh works" AND year_made = "1914" AND year_s__withdrawn = "1959"
### Instruction: When 7 april 2001 to 29 september 2001 was aired in japan 2 how many titles were there? ### Response:
SELECT COUNT(title) FROM table_1714685_1 WHERE aired_in_japan_3 = "7 April 2001 to 29 September 2001"
### Instruction: Users with most reputation from single post. ### Response:
SELECT p.OwnerUserId AS "user_link", u.Reputation FROM Posts AS p INNER JOIN Users AS u ON p.OwnerUserId = u.Id GROUP BY p.OwnerUserId, u.Reputation HAVING COUNT(p.Id) = 1 ORDER BY u.Reputation DESC LIMIT 100
### Instruction: For events that have more than one participant, count the event details for a bar chart, and list in ascending by the bars please. ### Response:
SELECT Event_Details, COUNT(Event_Details) FROM Events AS T1 JOIN Participants_in_Events AS T2 ON T1.Event_ID = T2.Event_ID GROUP BY Event_Details ORDER BY Event_Details
### Instruction: Top 30 users from Chandigarh. ### Response:
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%siddhapur%' OR UPPER(Location) LIKE '%SIDDHAPUR' ORDER BY Reputation DESC LIMIT 30
### Instruction: how many hours have passed since the patient 95057 was admitted to the hospital? ### Response:
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', admissions.admittime)) FROM admissions WHERE admissions.subject_id = 95057 AND admissions.dischtime IS NULL
### Instruction: What is the highest population in 1991 in Baden Bei Wien, and a 2007 population larger than 25,284? ### Response:
SELECT MAX(population_1991) FROM table_name_13 WHERE name = "baden bei wien" AND population_2007 > 25 OFFSET 284
### Instruction: Show the transaction type descriptions and dates if the share count is smaller than 10. ### Response:
SELECT T1.transaction_type_description, T2.date_of_transaction FROM ref_transaction_types AS T1 JOIN transactions AS T2 ON T1.transaction_type_code = T2.transaction_type_code WHERE T2.share_count < 10
### Instruction: What is the highest Km From Kingston, when Mi From Kingston is less than 108, and when Length Meters is 260.6? ### Response:
SELECT MAX("Km from Kingston") FROM table_9562 WHERE "Mi from Kingston" < '108' AND "Length meters" = '260.6'
### Instruction: What shows for 1987 when 1995 shows 1r, 1986 is a, and 1998 is sf? ### Response:
SELECT 1987 FROM table_name_47 WHERE 1995 = "1r" AND 1986 = "a" AND 1988 = "sf"
### Instruction: Bring the number of patients with elective hospital admission who had a joint fluid lab test. ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND lab.fluid = "Joint Fluid"
### Instruction: List the number of courses in year 2008 for each instructor in a bar chart. ### Response:
SELECT name, COUNT(name) FROM course AS T1 JOIN teaches AS T2 ON T1.course_id = T2.course_id JOIN instructor AS T3 ON T2.ID = T3.ID WHERE year = 2008 GROUP BY name
### Instruction: Find all the papers published by 'Aaron Turon'. ### Response:
SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Aaron" AND t1.lname = "Turon"
### Instruction: how many patients are married and tested with lab item id 50820? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "MARRIED" AND lab.itemid = "50820"
### Instruction: how many female patients are diagnosed with short title depress psychosis-unspec? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "F" AND diagnoses.short_title = "Depress psychosis-unspec"
### Instruction: What is the total number of Total Congregations, when % LDS is 0.54%, and when Population is greater than 105,275? ### Response:
SELECT COUNT("Total Congregations") FROM table_77479 WHERE "% LDS" = '0.54%' AND "Population" > '105,275'
### Instruction: Show me a bar chart about the number of races held in each year after 2014, I want to order y axis from low to high order please. ### Response:
SELECT year, COUNT(year) FROM races AS T1 JOIN results AS T2 ON T1.raceId = T2.raceId WHERE T1.year > 2014 ORDER BY COUNT(year)
### Instruction: What is zip code of customer with first name as Carole and last name as Bernhard? ### Response:
SELECT T2.zip_postcode FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = "Carole" AND T1.last_name = "Bernhard"
### Instruction: which journal did Donald E Knuth publish his last paper ? ### Response:
SELECT DISTINCT paper.journalid, paper.year FROM author, paper, writes WHERE author.authorname = 'Donald E Knuth' AND writes.authorid = author.authorid AND writes.paperid = paper.paperid GROUP BY paper.journalid, paper.year ORDER BY paper.year DESC
### Instruction: What is Package/Option, when HDTV is no, when Language is Italian, and when Television service is cartello promozionale sky hd? ### Response:
SELECT "Package/Option" FROM table_7179 WHERE "HDTV" = 'no' AND "Language" = 'italian' AND "Television service" = 'cartello promozionale sky hd'
### Instruction: find the diagnosis icd9 code for patient id 7578 and the number of days of his hospital stay. ### Response:
SELECT demographic.days_stay, diagnoses.icd9_code FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "7578"
### Instruction: What is the highest Against where they lost less than 20 games, tied more than 2 of them, and they had Favour less than 11? ### Response:
SELECT MAX("Against") FROM table_45481 WHERE "Lost" < '20' AND "Draw" > '2' AND "Favour" < '11'
### Instruction: how many dead patients had prescription for prapafenone hcl? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.expire_flag = "1" AND prescriptions.drug = "Propafenone HCl"
### Instruction: Which college/junior/team has defence as the position with canada as the nationality and the pick # is less than 61.0? ### Response:
SELECT college_junior_club_team FROM table_2897457_3 WHERE position = "Defence" AND nationality = "Canada" AND pick__number < 61.0
### Instruction: What is the lowest First Title, when All-Time is greater than 1, when Country is 'United States (USA)', and when Amateur Era is greater than 17? ### Response:
SELECT MIN(first_title) FROM table_name_13 WHERE all_time > 1 AND country = "united states (usa)" AND amateur_era > 17
### Instruction: On what date was the rd. time at 10 with Sammy Angott as an opponent with a record of 33 0? ### Response:
SELECT "Date" FROM table_6178 WHERE "Rd., Time" = '10' AND "Opponent" = 'sammy angott' AND "Record" = '33–0'
### Instruction: provide the number of patients whose admission type is emergency and admission location is phys referral/normal deli? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.admission_location = "PHYS REFERRAL/NORMAL DELI"
### Instruction: What is the total attendance with a Report of sd.hr, and a Score of 3 1, and a Date of 14 apr 2001? ### Response:
SELECT SUM(attendance) FROM table_name_22 WHERE report = "sd.hr" AND score = "3–1" AND date = "14 apr 2001"
### Instruction: according to this table , did mexico or italy have more ` friendly ' competitions against spain ? ### Response:
SELECT "opponent" FROM table_203_431 WHERE "opponent" IN ('mexico', 'italy') AND "competition" = 'friendly' GROUP BY "opponent" ORDER BY COUNT(*) DESC LIMIT 1
### Instruction: what is the number of patients whose religion is catholic and lab test name is protein, total? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.religion = "CATHOLIC" AND lab.label = "Protein, Total"
### Instruction: Return the ids and details corresponding to projects for which there are more than two documents in a bar chart, could you list y axis from low to high order? ### Response:
SELECT T1.Project_Details, T1.Project_ID FROM Projects AS T1 JOIN Documents AS T2 ON T1.Project_ID = T2.Project_ID ORDER BY T1.Project_ID
### Instruction: Posts containing string1 but not string2. ### Response:
SELECT Id AS "post_link", OwnerUserId AS "user_link", CreationDate, LastActivityDate, Score, ViewCount, Body FROM Posts WHERE (Body LIKE '%##string1##%') AND NOT (Body LIKE '%##string2##%') ORDER BY CreationDate DESC LIMIT 100
### Instruction: return me the authors who have papers in PVLDB after 2010 . ### Response:
SELECT author.name FROM author, journal, publication, writes WHERE journal.name = 'PVLDB' AND publication.jid = journal.jid AND publication.year > 2010 AND writes.aid = author.aid AND writes.pid = publication.pid
### Instruction: What is Manufacturer, when Finish is greater than 29, when Start is less than 23, and when Year is '1973'? ### Response:
SELECT "Manufacturer" FROM table_61681 WHERE "Finish" > '29' AND "Start" < '23' AND "Year" = '1973'
### Instruction: Number of posts by year. ### Response:
SELECT DATEDIFF(day, CreationDate, GETDATE()) / 365 AS yearsBack, COUNT(Id) AS postsCount FROM Posts GROUP BY DATEDIFF(day, CreationDate, GETDATE()) / 365 ORDER BY DATEDIFF(day, CreationDate, GETDATE()) / 365 DESC
### Instruction: what is the number of patients whose item id is 51213 and lab test abnormal status is delta? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "51213" AND lab.flag = "delta"
### Instruction: What's listed for the 2012 that has a 2011 of 7.7% with a 2008 of 7.9%? ### Response:
SELECT "2012" FROM table_37724 WHERE "2011" = '7.7%' AND "2008" = '7.9%'
### Instruction: Name the least cuts for top-5 more than 2 with top 25 less than 6 and top 10 less than 11 ### Response:
SELECT MIN("Cuts made") FROM table_6265 WHERE "Top-10" < '11' AND "Top-5" > '2' AND "Top-25" < '6'
### Instruction: Which quantity has Axle arrangement (UIC)bauart of c n2t, and DRG number 99 093? ### Response:
SELECT "Quantity" FROM table_64812 WHERE "Axle arrangement ( UIC ) Bauart" = 'c n2t' AND "DRG number(s)" = '99 093'
### Instruction: Which municipality's area is outer circle south and smaller than 368 km in Akershus County with more than 14,398 people? ### Response:
SELECT municipality FROM table_name_2 WHERE area = "outer circle south" AND area_km² < 368 AND county = "akershus" AND population > 14 OFFSET 398
### Instruction: What is the average 2011-03, when Unemployment is Sweden, and when 2009-03 is greater than 8? ### Response:
SELECT AVG("2011-03") FROM table_7494 WHERE "Unemployment" = 'sweden' AND "2009-03" > '8'
### Instruction: How many patients with elective hospital admissions had mesothelial cells lab test done? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND lab.label = "Mesothelial cells"
### Instruction: uncontrolled hypertension ( bp > 160 / 100 mm of hg ) ### Response:
SELECT * FROM table_dev_11 WHERE hypertension = 1 OR (systolic_blood_pressure_sbp > 160 OR diastolic_blood_pressure_dbp > 100)
### Instruction: Find the name of account that has the lowest total checking and saving balance. ### Response:
SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid ORDER BY T2.balance + T3.balance LIMIT 1
### Instruction: What are the the full names and ids for all customers, and how many accounts does each have? ### Response:
SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name, COUNT(*) FROM accounts AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id
### Instruction: what is the name when the type is hydro, the capacity (mw) is less than 478, the rank is more than 85 and the province is quebec? ### Response:
SELECT name FROM table_name_15 WHERE type = "hydro" AND capacity___mw__ < 478 AND rank > 85 AND province = "quebec"
### Instruction: how many patients whose days of hospital stay is greater than 2 and procedure short title is spinal tap? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "2" AND procedures.short_title = "Spinal tap"
### Instruction: What is the sum of balls faced associated with a strike rate over 48.28, 3 innings, and an average under 5? ### Response:
SELECT SUM("Balls Faced") FROM table_42207 WHERE "S.R." > '48.28' AND "Innings" = '3' AND "Average" < '5'
### Instruction: What was the license award date for the ensemble from South Wales and the Severn Estuary that was on air in July 2001? ### Response:
SELECT "Licence award date" FROM table_4489 WHERE "On air date" = 'july 2001' AND "Region" = 'south wales and the severn estuary'
### Instruction: What is the Word Form, when the Khmer is greater than , and the UNGEGN is (mu y) d b le n? ### Response:
SELECT word_form FROM table_name_39 WHERE khmer > ១០០០០០ AND ungegn = "(muŏy) dáb leăn"
### Instruction: What is the total salary paid by team Boston Red Stockings in 2010? ### Response:
SELECT SUM(T1.salary) FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year = 2010
### Instruction: What is the name and job title of the staff who was assigned the latest? ### Response:
SELECT T1.staff_name, T2.job_title_code FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id ORDER BY T2.date_assigned_to DESC LIMIT 1
### Instruction: How many entries are there for team coxy for the air date of 24 january 2010 and team guest captain of gail porter? ### Response:
SELECT COUNT("Team Coxy") FROM table_28134 WHERE "Air Date" = '24 January 2010' AND "Team guest captain" = 'Gail Porter'
### Instruction: Find the number of the name of rooms booked by some customers whose first name contains ROY, and sort in ascending by the bar. ### Response:
SELECT roomName, COUNT(roomName) FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE FirstName LIKE '%ROY%' GROUP BY roomName ORDER BY roomName
### Instruction: How many touchdowns did the player with less than 4495 yards, long of less than 80, and yds/att less than 5.5 have? ### Response:
SELECT COUNT(touchdowns) FROM table_name_65 WHERE net_yds < 4495 AND long < 80 AND yds_att < 5.5
### Instruction: how many patients whose gender is f and diagnoses short title is hypovolemia? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "F" AND diagnoses.short_title = "Hypovolemia"
### Instruction: what venue does Luke Zettlemoyer publish the most in ### Response:
SELECT DISTINCT COUNT(1), paper.venueid FROM author, paper, writes WHERE author.authorname = 'Luke Zettlemoyer' AND writes.authorid = author.authorid AND writes.paperid = paper.paperid GROUP BY paper.venueid ORDER BY COUNT(1) DESC
### Instruction: Show the id and details for the investors who have the top 3 number of transactions. Show the proportion. ### Response:
SELECT T1.Investor_details, T1.investor_id FROM Investors AS T1 JOIN Transactions AS T2 ON T1.investor_id = T2.investor_id ORDER BY COUNT(*) DESC LIMIT 3
### Instruction: Return the ids of all products that were ordered more than three times or supplied more than 80000. ### Response:
SELECT product_id FROM order_items GROUP BY product_id HAVING COUNT(*) > 3 UNION SELECT product_id FROM product_suppliers GROUP BY product_id HAVING SUM(total_amount_purchased) > 80000