instruction
stringlengths
53
549
output
stringlengths
30
2.33k
### Instruction: give me the number of patients whose discharge location is snf and lab test name is magnesium? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.discharge_location = "SNF" AND lab.label = "Magnesium"
### Instruction: For the year 1975, what is Propulsion, with a Number (quantity ordered) of 4756-4788 (33 buses)? ### Response:
SELECT fuel_propulsion FROM table_name_41 WHERE year = 1975 AND numbers__quantity_ordered_ = "4756-4788 (33 buses)"
### Instruction: Please return me a histogram to show the friends, and ages of all people who are older than the average age of a person?, order from low to high by the x axis. ### Response:
SELECT friend, age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.age > (SELECT AVG(age) FROM Person) ORDER BY friend
### Instruction: Show the names of pilots and models of aircrafts they have flied with. ### Response:
SELECT T3.Pilot_name, T2.Model FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN pilot AS T3 ON T1.Pilot_ID = T3.Pilot_ID
### Instruction: calculate the total number of male patients among those who had other finger(s) amputation status ### 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.long_title = "Other finger(s) amputation status"
### Instruction: Does ali farhadi publish in cvpr ? ### Response:
SELECT DISTINCT paper.paperid FROM author, paper, venue, writes WHERE author.authorname = 'ali farhadi' AND venue.venueid = paper.venueid AND venue.venuename = 'cvpr' AND writes.authorid = author.authorid AND writes.paperid = paper.paperid
### Instruction: what's the cost of a drug named insulin-regular (human) *unit* inj? ### Response:
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'medication' AND cost.eventid IN (SELECT medication.medicationid FROM medication WHERE medication.drugname = 'insulin-regular (human) *unit* inj')
### Instruction: WHAT IS THE GRID OF HONDA, WITH 24 LAPS AND Time/Retired of +13.997? ### Response:
SELECT "Grid" FROM table_47682 WHERE "Manufacturer" = 'honda' AND "Laps" = '24' AND "Time/Retired" = '+13.997'
### Instruction: what were the five most common intakes? ### Response:
SELECT t1.celllabel FROM (SELECT intakeoutput.celllabel, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM intakeoutput WHERE intakeoutput.cellpath LIKE '%intake%' GROUP BY intakeoutput.celllabel) AS t1 WHERE t1.c1 <= 5
### Instruction: What is the highest GEO ID for land masses over 38.117 sq mi and over 2.065 sq mi of water? ### Response:
SELECT MAX("GEO ID") FROM table_63181 WHERE "Land ( sqmi )" > '38.117' AND "Water (sqmi)" > '2.065'
### Instruction: What is the average age of students who have city code 'NYC' and have secretary votes for the spring election cycle? ### Response:
SELECT AVG(T1.age) FROM student AS T1 JOIN voting_record AS T2 ON T1.stuid = secretary_vote WHERE T1.city_code = "NYC" AND T2.election_cycle = "Spring"
### Instruction: state the number of surface where championship is australian open and score in the final is 6 3, 4 6, 11 9 ### Response:
SELECT COUNT("Surface") FROM table_22875 WHERE "Championship" = 'Australian Open' AND "Score in the final" = '6–3, 4–6, 11–9'
### Instruction: how much does the cost of diagnosing ards - non-pulmonary etiology cost? ### Response:
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'diagnosis' AND cost.eventid IN (SELECT diagnosis.diagnosisid FROM diagnosis WHERE diagnosis.diagnosisname = 'ards - non-pulmonary etiology')
### Instruction: count the number of patients whose admission type is elective and lab test category is chemistry? ### 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."CATEGORY" = "Chemistry"
### Instruction: provide the number of patients whose lab test abnormal status is abnormal and lab test name is rbc, joint fluid? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.flag = "abnormal" AND lab.label = "RBC, Joint Fluid"
### Instruction: get the number of alive patients who underwent open biopsy of soft tissue. ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "0" AND procedures.long_title = "Open biopsy of soft tissue"
### Instruction: who was the Stage winner when the stage was smaller than 16, earlier than 1986, and a distance (km) was 19.6? ### Response:
SELECT "Stage winner" FROM table_13568 WHERE "Stage" < '16' AND "Year" < '1986' AND "Distance (km)" = '19.6'
### Instruction: how many patients whose gender is f and diagnoses icd9 code is 3572? ### 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.icd9_code = "3572"
### Instruction: What is the total number of her age figures where his age is less than 33, the bride was diontha walker, and the number of children was less than 0? ### Response:
SELECT SUM(her_age) FROM table_name_84 WHERE his_age < 33 AND name = "diontha walker" AND _number_of_children < 0
### Instruction: Show me the frequency of those years (bin year into year interval) that the team Boston Red Stockings won in the postseasons with a bar chart. ### Response:
SELECT year, COUNT(year) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings'
### Instruction: What is the least number of Gold for a Rank smaller than 5, and 1 silver medal for Poland with more than 1 medal in total? ### Response:
SELECT MIN("Gold") FROM table_10890 WHERE "Rank" < '5' AND "Silver" = '1' AND "Nation" = 'poland' AND "Total" > '1'
### Instruction: Return the average total amount purchased and total value purchased for the supplier who supplies the greatest number of products. ### Response:
SELECT AVG(total_amount_purchased), AVG(total_value_purchased) FROM product_suppliers WHERE supplier_id = (SELECT supplier_id FROM product_suppliers GROUP BY supplier_id ORDER BY COUNT(*) DESC LIMIT 1)
### Instruction: My Community User Rejected Edits. ### Response:
SELECT COUNT(UserId) FROM SuggestedEditVotes INNER JOIN SuggestedEdits ON SuggestedEdits.Id = SuggestedEditVotes.SuggestedEditId WHERE TargetUserId = '##UserId##' AND VoteTypeId = 3 AND NOT SuggestedEdits.RejectionDate IS NULL
### Instruction: What are the songs in album 'A Kiss Before You Go: Live in Hamburg'? ### Response:
SELECT T3.title FROM albums AS T1 JOIN tracklists AS T2 ON T1.aid = T2.albumid JOIN songs AS T3 ON T2.songid = T3.songid WHERE T1.title = "A Kiss Before You Go: Live in Hamburg"
### Instruction: When are the birthdays of customer who are classified as 'Good Customer' status, and count them by a line chart, and could you list by the date_of_birth from low to high? ### Response:
SELECT date_of_birth, COUNT(date_of_birth) FROM Customers WHERE customer_status_code = 'Good Customer' ORDER BY date_of_birth
### Instruction: What is the 1995 GDP when 1990 GDP is 441 and 1985 GDP is less than 359? ### Response:
SELECT MIN("1995") FROM table_52809 WHERE "1990" = '441' AND "1985" < '359'
### Instruction: what is 2012-13 when 2011-12 is dnp and event is autumn gold? ### Response:
SELECT "2012\u201313" FROM table_45124 WHERE "2011\u201312" = 'dnp' AND "Event" = 'autumn gold'
### Instruction: tommy taylor had the same number of goals as which other player -lrb- s -rrb- ? ### Response:
SELECT "name" FROM table_203_753 WHERE "name" <> 'tommy taylor' AND "goals" = (SELECT "goals" FROM table_203_753 WHERE "name" = 'tommy taylor')
### Instruction: Watson Studio questions - July 2019. ### Response:
SELECT Id, Body, CreationDate, ViewCount, Tags FROM Posts WHERE Tags LIKE '%watson-studio%' AND ParentId IS NULL AND CreationDate > '2019-07-01' AND CreationDate <= '2019-07-31' ORDER BY CreationDate DESC
### Instruction: how many patients whose admission type is urgent and item id is 50806? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "URGENT" AND lab.itemid = "50806"
### Instruction: give me the number of patients who are taking drug via im route and are less than 61 years of age. ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "61" AND prescriptions.route = "IM"
### Instruction: What are the line 1 of addresses shared by some students and some teachers? ### Response:
SELECT T1.line_1 FROM addresses AS T1 JOIN students AS T2 ON T1.address_id = T2.address_id INTERSECT SELECT T1.line_1 FROM addresses AS T1 JOIN teachers AS T2 ON T1.address_id = T2.address_id
### Instruction: What is the party with the candidates newt gingrich (r) 59.1% dock h. davis (d) 40.9%? ### Response:
SELECT party FROM table_1341640_11 WHERE candidates = "Newt Gingrich (R) 59.1% Dock H. Davis (D) 40.9%"
### Instruction: what is the difference in tonnes between the malabar class and the ut507 class ? ### Response:
SELECT ABS((SELECT "displacement" FROM table_203_201 WHERE "class" = 'malabar class') - (SELECT "displacement" FROM table_203_201 WHERE "class" = 'ut507 class'))
### Instruction: count the number of patients admitted before the year 2164 whose lab test name is lactate. ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2164" AND lab.label = "Lactate"
### Instruction: what are the hospitals admission times of patient 002-35416 since 4 years ago? ### Response:
SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '002-35416' AND DATETIME(patient.hospitaladmittime) >= DATETIME(CURRENT_TIME(), '-4 year')
### Instruction: How many Persian Wars have a School of rashtriya indian military college, and an 1860-1878 smaller than 0? ### Response:
SELECT COUNT("Persian War") FROM table_71318 WHERE "School" = 'rashtriya indian military college' AND "1860-1878" < '0'
### Instruction: Suggested edits with offensive texts. ### Response:
SELECT 'site://review/suggested-edits/' + CAST(t.Id AS TEXT) FROM SuggestedEdits AS e INNER JOIN ReviewTasks AS t ON t.SuggestedEditId = e.Id WHERE e.Text LIKE '%nigger%' AND e.ApprovalDate IS NULL LIMIT 10
### Instruction: what number of male patients had the diagnosis icd9 code 43491? ### 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.icd9_code = "43491"
### Instruction: what is the number of patients whose hospital stay is above 6 days and with lab test category chemistry? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "6" AND lab."CATEGORY" = "Chemistry"
### Instruction: What is the average prominence in m of pietrosul rodnei peak, which has an elevation less than 2,303? ### Response:
SELECT AVG("Prominence (m)") FROM table_65944 WHERE "Peak" = 'pietrosul rodnei' AND "Elevation (m)" < '2,303'
### Instruction: What is the mean on-site ATMS that have off-site ATMs of 1567, and the total number of ATMs less than 4772? ### Response:
SELECT AVG(on_site_atms) FROM table_name_20 WHERE off_site_atms = 1567 AND total_atms < 4772
### Instruction: What is the Appointed by that has the Title of Ambassador Extraordinary and Plenipotentiary and has a Representative of Spruille Braden? ### Response:
SELECT "Appointed by" FROM table_15170 WHERE "Title" = 'ambassador extraordinary and plenipotentiary' AND "Representative" = 'spruille braden'
### Instruction: What is the lowest rank for an album after 1999 and an Accolade of the 100 greatest indie rock albums of all time? ### Response:
SELECT MIN("Rank") FROM table_35414 WHERE "Year" > '1999' AND "Accolade" = 'the 100 greatest indie rock albums of all time'
### Instruction: Which all are the MDE classes ? ### Response:
SELECT DISTINCT course.department, course.name, course.number FROM course, program, program_course WHERE program_course.category LIKE '%MDE%' AND program_course.course_id = course.course_id AND program.name LIKE '%CS-LSA%' AND program.program_id = program_course.program_id
### Instruction: how many of the patients with icd9 code 4513 have unspecified death status ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "0" AND procedures.icd9_code = "4513"
### Instruction: report the number of emergency hospital admission patients who were ordered ascitic fluid lab test check. ### 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.fluid = "Ascites"
### Instruction: Which Pick # has a Round larger than 5, and a Position of wide receiver, and a Name of gregory spann, and an Overall larger than 228? ### Response:
SELECT AVG(pick__number) FROM table_name_67 WHERE round > 5 AND position = "wide receiver" AND name = "gregory spann" AND overall > 228
### Instruction: What is the Outcome of the match with Partner Marcella Mesker and a Score of 6 4, 4 6, 4 6? ### Response:
SELECT "Outcome" FROM table_61217 WHERE "Partner" = 'marcella mesker' AND "Score" = '6–4, 4–6, 4–6'
### Instruction: Provide the number of patients admitted to the hospital before the year 2115 whose primary disease is gastrointestinal bleed. ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "GASTROINTESTINAL BLEED" AND demographic.admityear < "2115"
### Instruction: A bar chart for showing the number of the facility codes of apartments with more than 4 bedrooms. ### Response:
SELECT facility_code, COUNT(facility_code) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 4 GROUP BY facility_code
### Instruction: Users who start questions with 'So ...'. ### Response:
SELECT p.Id AS "post_link" FROM Posts AS p JOIN Users AS u ON p.OwnerUserId = u.Id WHERE p.PostTypeId = 2 AND p.OwnerUserId = '##UserId:int##' AND UPPER(p.Body) LIKE UPPER('%##CommentText##%')
### Instruction: just count the number of patients who had been prescribed oxycodone-acetaminophen. ### Response:
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT prescriptions.hadm_id FROM prescriptions WHERE prescriptions.drug = 'oxycodone-acetaminophen')
### Instruction: how many female patients were prescribed the drug quetiapine fumarate? ### 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.drug = "Quetiapine Fumarate"
### Instruction: For those records from the products and each product's manufacturer, find name and the average of revenue , and group by attribute name, and visualize them by a bar chart. ### Response:
SELECT T2.Name, T2.Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name
### Instruction: What was the sum of Revenue ($M), when the Debt as % of value was higher than 27, and the Operating income($m) was 77? ### Response:
SELECT SUM("Revenue ($M)") FROM table_71279 WHERE "Debt as %of value" > '27' AND "Operating income($m)" = '77'
### Instruction: What is Outcome, when Partner is 'Byron Black', and when Opponents is 'Goran Ivani evi Brian Macphie'? ### Response:
SELECT "Outcome" FROM table_48856 WHERE "Partner" = 'byron black' AND "Opponents" = 'goran ivanišević brian macphie'
### Instruction: provide the number of male patients whose drug code is mido5. ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.gender = "M" AND prescriptions.formulary_drug_cd = "MIDO5"
### Instruction: How much 1969 has a 1967 smaller than 0.73, and a 1964 larger than 0.07? ### Response:
SELECT COUNT("1969") FROM table_64934 WHERE "1967" < '0.73' AND "1964" > '0.07'
### Instruction: What displacement is the model in 1999 with a Torque of 280n m (207lb ft) @ 1750? ### Response:
SELECT displacement FROM table_name_61 WHERE year = 1999 AND torque = "280n·m (207lb·ft) @ 1750"
### Instruction: count the number of patients whose gender is m and procedure long title is transfusion of packed cells? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.gender = "M" AND procedures.long_title = "Transfusion of packed cells"
### Instruction: What is the lowest January, when Game is less than 46, when Score is '5 - 3', and when Record is '15-22-8'? ### Response:
SELECT MIN(january) FROM table_name_94 WHERE game < 46 AND score = "5 - 3" AND record = "15-22-8"
### Instruction: What laps have a rank larger than 13 and the Time/Retired is accident, and a Qual smaller than 136.98? ### Response:
SELECT "Laps" FROM table_56486 WHERE "Rank" > '13' AND "Time/Retired" = 'accident' AND "Qual" < '136.98'
### Instruction: Questions with No Accepted Answer by Tag. ### Response:
SELECT TagName, COUNT(TagName) FROM Posts INNER JOIN PostTags ON PostTags.PostId = Posts.Id INNER JOIN Tags ON PostTags.TagId = Tags.Id WHERE PostTypeId = 1 AND AcceptedAnswerId IS NULL AND NOT ClosedDate IS NULL GROUP BY TagName ORDER BY COUNT(TagName) DESC
### Instruction: how many patients who had rdw lab test left against medical advice? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.discharge_location = "LEFT AGAINST MEDICAL ADVI" AND lab.label = "RDW"
### Instruction: Which gold Coast has a Melbourne of yes, a Perth of yes, an Auckland of no, and a Sydney of no? ### Response:
SELECT "Gold Coast" FROM table_15344 WHERE "Melbourne" = 'yes' AND "Perth" = 'yes' AND "Auckland" = 'no' AND "Sydney" = 'no'
### Instruction: What is the Year commissioned of the power station with a Gross head of 60 metres and Average annual output of less than 59 million KWh? ### Response:
SELECT MAX(year_commissioned) FROM table_name_75 WHERE gross_head__metres_ = 60 AND average_annual_output__million_kwh_ < 59
### Instruction: Show all cities along with the number of drama workshop groups in each city with a bar chart, show in asc by the the total number . ### Response:
SELECT City_Town, COUNT(*) FROM Addresses AS T1 JOIN Drama_Workshop_Groups AS T2 ON T1.Address_ID = T2.Address_ID GROUP BY T1.City_Town ORDER BY COUNT(*)
### Instruction: find out how many patients were discharged from the hospital during the previous year. ### Response:
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE NOT patient.hospitaldischargetime IS NULL AND DATETIME(patient.hospitaldischargetime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')
### Instruction: For those records from the products and each product's manufacturer, visualize a bar chart about the distribution of name and code , and group by attribute headquarter. ### Response:
SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter, T1.Name
### Instruction: What was the Company or Product name where Entrepreneurs Geoff and Colette Bell requested 75,000? ### Response:
SELECT "Company or product name" FROM table_71893 WHERE "Money requested (\u00a3)" = '75,000' AND "Entrepreneur(s)" = 'geoff and colette bell'
### Instruction: How many students are affected by each allergy type Visualize by bar chart, could you display total number in descending order please? ### Response:
SELECT AllergyType, COUNT(*) FROM Has_Allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy GROUP BY T2.AllergyType ORDER BY COUNT(*) DESC
### Instruction: what is the number of patients whose age is less than 56 and drug type is main? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "56" AND prescriptions.drug_type = "MAIN"
### Instruction: What number of hispanic, latino, or puerto rican patients are divorced? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "DIVORCED" AND demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN"
### Instruction: What was the percentage increase in spending on international tourism from 2011 to 2012 of the country that spent $85.9 billion in 2011? ### Response:
SELECT _percentage_change FROM table_29789_3 WHERE international_tourism_expenditure_2011 = "$85.9 billion"
### Instruction: What is the total number of MEPs that has 465,955 inhabitants per MEP and an influence smaller than 1.79? ### Response:
SELECT COUNT("MEPs") FROM table_42957 WHERE "Inhabitants per MEP" = '465,955' AND "Influence" < '1.79'
### Instruction: What is the average age of the members of the club 'Bootup Baltimore'? ### Response:
SELECT AVG(t3.age) 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 t1.clubname = "Bootup Baltimore"
### Instruction: Find the number of scientists involved for the projects that require more than 300 hours Show bar chart, and list X-axis in ascending order. ### Response:
SELECT Name, COUNT(*) FROM Projects AS T1 JOIN AssignedTo AS T2 ON T1.Code = T2.Project WHERE T1.Hours > 300 GROUP BY T1.Name ORDER BY Name
### Instruction: what is the avaerage of patients whose admission location is phys referral/normal deli and have stayed in the hospital for 29 days? ### Response:
SELECT AVG(demographic.age) FROM demographic WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND demographic.days_stay = "29"
### Instruction: What Dissolved has a 2nd member of humphrey winch, and Assembled of 27 october 1601? ### Response:
SELECT "Dissolved" FROM table_13111 WHERE "2nd member" = 'humphrey winch' AND "Assembled" = '27 october 1601'
### Instruction: Give me a list of names and years of races that had any driver whose forename is Lewis? ### Response:
SELECT T2.name, T2.year FROM results AS T1 JOIN races AS T2 ON T1.raceid = T2.raceid JOIN drivers AS T3 ON T1.driverid = T3.driverid WHERE T3.forename = "Lewis"
### Instruction: For those records from the products and each product's manufacturer, give me the comparison about revenue over the name , and group by attribute founder by a bar chart. ### Response:
SELECT T1.Name, T2.Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder, T1.Name
### Instruction: What is the total number of 4th place that has 3 appearances for 3, and a more than 0 silver medals, and no gold medals? ### Response:
SELECT COUNT("4th Place") FROM table_7109 WHERE "Appearances" = '3' AND "Silver Medals" > '0' AND "Gold Medals" < '0'
### Instruction: Which film has the most number of actors or actresses? List the film name, film id and description. ### Response:
SELECT T2.title, T2.film_id, T2.description FROM film_actor AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T2.film_id ORDER BY COUNT(*) DESC LIMIT 1
### Instruction: When playing on grass who was the opponents in a year greater than 1993, and playing with Jonas Bj rkman? ### Response:
SELECT "Opponents" FROM table_41617 WHERE "Surface" = 'grass' AND "Year" > '1993' AND "Partner" = 'jonas björkman'
### Instruction: which chip has the larger flash size , at90s/ls4434 or at90s8515 ? ### Response:
SELECT "chip" FROM table_204_416 WHERE "chip" IN ('at90s/ls4434', 'at90s8515') ORDER BY "flash size" DESC LIMIT 1
### Instruction: What is the distinct service types that are provided by the organization which has detail 'Denesik and Sons Party'? ### Response:
SELECT DISTINCT T1.service_type_code FROM services AS T1 JOIN organizations AS T2 ON T1.organization_id = T2.organization_id WHERE T2.organization_details = 'Denesik and Sons Party'
### Instruction: give me the number of patients whose diagnoses short title is dmi neuro nt st uncntrld? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.short_title = "DMI neuro nt st uncntrld"
### Instruction: give me the number of patients whose drug name is nitroglycerin ointment 2%? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "Nitroglycerin Ointment 2%"
### Instruction: how many patients whose insurance is medicaid and lab test name is creatinine, urine? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.insurance = "Medicaid" AND lab.label = "Creatinine, Urine"
### Instruction: Give me the number of patients less than 58 years for whom a rbc csf lab test order was placed. ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "58" AND lab.label = "RBC, CSF"
### Instruction: how many patients from white ethnic origin had pressure ulcer, stage ii? ### 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.short_title = "Pressure ulcer, stage II"
### Instruction: List the first and last names of all distinct staff members who are assigned to the problem whose id is 1. ### Response:
SELECT DISTINCT staff_first_name, staff_last_name FROM staff AS T1 JOIN problem_log AS T2 ON T1.staff_id = T2.assigned_to_staff_id WHERE T2.problem_id = 1
### Instruction: tell me the price of a procedure called agent specific therapy - calcium channel blockers overdose? ### Response:
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'treatment' AND cost.eventid IN (SELECT treatment.treatmentid FROM treatment WHERE treatment.treatmentname = 'agent specific therapy - calcium channel blockers overdose')
### Instruction: Show names of technicians in ascending order of quality rank of the machine they are assigned. ### Response:
SELECT T3.Name FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id = T2.machine_id JOIN technician AS T3 ON T1.technician_ID = T3.technician_ID ORDER BY T2.quality_rank
### Instruction: count the number of patients whose admission type is elective 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.admission_type = "ELECTIVE" AND lab.fluid = "Other Body Fluid"
### Instruction: how many patients are under 61 years of age and use the drug route inhalation? ### Response:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "61" AND prescriptions.route = "INHALATION"
### Instruction: is 08-0av heavier than 08-0lx ? ### Response:
SELECT (SELECT "weight" FROM table_204_131 WHERE "tops design code" = '08-0av') > (SELECT "weight" FROM table_204_131 WHERE "tops design code" = '08-0lx')
### Instruction: Display a bar chart for what is the name of each course and the corresponding number of student enrollment?, sort in desc by the Y. ### Response:
SELECT course_name, COUNT(*) FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name ORDER BY COUNT(*) DESC
### Instruction: Posts tagged with tag that contain the tag as title prefix. ### Response:
SELECT Id AS "post_link", Tags, Score, AnswerCount AS Answers FROM Posts WHERE STR_POSITION(Tags, @tag) > 0 AND LOWER(Title) LIKE REPLACE(@tag, '-', ' ') + '%' AND ClosedDate IS NULL ORDER BY Score DESC