table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
CREATE TABLE table_name_28 ( jun VARCHAR, jul VARCHAR )
Name the june when it has july of 84 f / 28.9 c
SELECT jun FROM table_name_28 WHERE jul = "84 °f / 28.9 °c"
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0...
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, find hire_date and the average of salary bin hire_date by weekday, and visualize them by a bar chart, I want to order in asc by the Y-axis.
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY AVG(SALARY)
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ...
Count the number of divorced patients who had tacrofk lab tests done.
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 = "tacroFK"
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
what is average age of patients whose primary disease is aortic insufficiency\re-do sternotomy; aortic valve replacement and days of hospital stay is 10?
SELECT AVG(demographic.age) FROM demographic WHERE demographic.diagnosis = "AORTIC INSUFFICIENCY\RE-DO STERNOTOMY; AORTIC VALVE REPLACEMENT " AND demographic.days_stay = "10"
CREATE TABLE table_32875 ( "Name" text, "Circuit" text, "Date" text, "Winning driver" text, "Winning constructor" text, "Report" text )
Which winning driver of the Roussillon Grand Prix had an Alfa Romeo?
SELECT "Winning driver" FROM table_32875 WHERE "Winning constructor" = 'alfa romeo' AND "Name" = 'roussillon grand prix'
CREATE TABLE table_50345 ( "Callsign" text, "Area served" text, "Band" text, "Freq currently" text, "Purpose" text )
What is the Purpose of the Callsign with a Freq currently of 4gld?
SELECT "Purpose" FROM table_50345 WHERE "Freq currently" = '4gld'
CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate ti...
Number of users created per month.
SELECT * FROM Users LIMIT 10
CREATE TABLE table_6141 ( "Team 1" text, "Agg." text, "Team 2" text, "1st leg" text, "2nd leg" text )
What is the 1st leg of the team with a 2-1 agg.?
SELECT "1st leg" FROM table_6141 WHERE "Agg." = '2-1'
CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, ...
top 10 users by post score.
SELECT Users.Id AS "user_link", MAX(Age) AS Age, MAX(Location) AS Location, MAX(WebsiteUrl) AS Website, MAX(Reputation) AS Rep, COUNT(Answers.Id) AS Answers, SUM(Answers.Score) AS Score, CAST(AVG(CAST(Answers.Score AS FLOAT)) AS FLOAT(6, 1)) AS "avg" FROM Tags JOIN PostTags ON PostTags.TagId = Tags.Id JOIN Posts ON Pos...
CREATE TABLE participants ( participant_id number, participant_type_code text, participant_details text ) CREATE TABLE services ( service_id number, service_type_code text ) CREATE TABLE events ( event_id number, service_id number, event_details text ) CREATE TABLE participants_in_eve...
What are all the the participant ids, type code and details?
SELECT participant_id, participant_type_code, participant_details FROM participants
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime t...
when was patient 015-52724 last prescribed both lorazepam and methylprednisolone at the same time since 54 months ago?
SELECT t1.drugstarttime FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'lorazepam' AND patient.uniquepid = '015-52724' AND DATETIME(medication.drugstarttime) >= DATETIME(CURRENT_TIME(), '-54 mo...
CREATE TABLE table_1342370_10 ( district VARCHAR, first_elected VARCHAR )
In what district was the representative first elected in 1916?
SELECT district FROM table_1342370_10 WHERE first_elected = 1916
CREATE TABLE table_61823 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Results" text )
What is the party for the representative who was first elected before 2002 and the results were re-elected?
SELECT "Party" FROM table_61823 WHERE "Results" = 're-elected' AND "First elected" < '2002'
CREATE TABLE table_14433719_1 ( time___et__ VARCHAR, opponent VARCHAR )
What time in eastern standard time was game held at denver broncos?
SELECT time___et__ FROM table_14433719_1 WHERE opponent = "at Denver Broncos"
CREATE TABLE table_10753917_1 ( margin_of_defeat VARCHAR, points VARCHAR )
Which margin of defeats had points of 30?
SELECT margin_of_defeat FROM table_10753917_1 WHERE points = "30"
CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number ) CRE...
Questions with No accepted answer where I have the highest score.
SELECT q.Id AS "post_link" FROM Posts AS a INNER JOIN Posts AS q ON q.Id = a.ParentId WHERE a.OwnerUserId = '##UserID##' AND (SELECT MAX(p.Score) FROM Posts AS p WHERE p.ParentId = q.Id AND p.Id != a.Id) < a.Score ORDER BY q.ViewCount DESC
CREATE TABLE table_name_40 ( dob VARCHAR, surname VARCHAR )
Which DOB has a Surname of cresswell?
SELECT dob FROM table_name_40 WHERE surname = "cresswell"
CREATE TABLE table_29636 ( "Season" text, "Episodes" real, "Timeslot ( EST )" text, "Season premiere" text, "Season finale" text, "TV season" text, "Rank" text, "Viewers (in millions)" text )
How many season premieres had 15.27 million viewers?
SELECT COUNT("Season premiere") FROM table_29636 WHERE "Viewers (in millions)" = '15.27'
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellv...
how many patients since 2105 have received a sputum, tracheal specimen microbiological test?
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT microlab.patientunitstayid FROM microlab WHERE microlab.culturesite = 'sputum, tracheal specimen' AND STRFTIME('%y', microlab.culturetakentime) >= '2105')
CREATE TABLE table_name_36 ( county VARCHAR, mascot VARCHAR )
Which County has a Mascot of pacers?
SELECT county FROM table_name_36 WHERE mascot = "pacers"
CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE tra...
when was patient 20693's first operation since 3 years ago?
SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 20693) AND DATETIME(procedures_icd.charttime) >= DATETIME(CURRENT_TIME(), '-3 year') ORDER BY procedures_icd.charttime LIMIT 1
CREATE TABLE table_78481 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
During st kilda's home game, what was the number of people in the crowd?
SELECT "Crowd" FROM table_78481 WHERE "Home team" = 'st kilda'
CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAno...
Automation Test Engineer - Lisbon.
SELECT u.Id AS "user_link", CONCAT('https://stackoverflow.com/users/', u.Id) AS "profile_link", u.DisplayName, u.Location, u.WebsiteUrl, u.AboutMe, u.Views, u.UpVotes, u.DownVotes FROM Users AS u JOIN (SELECT DISTINCT UserId FROM Badges WHERE LOWER(Name) IN ('android-espresso') AND Class IN (1, 2, 3) AND TagBased = 1) ...
CREATE TABLE table_50302 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
What is the lowest Gold, when Silver is 0, and when Bronze is 2?
SELECT MIN("Gold") FROM table_50302 WHERE "Silver" = '0' AND "Bronze" = '2'
CREATE TABLE table_14045 ( "Polling firm" text, "Dates" text, "Prog. Cons." text, "New Democratic" text, "Liberal" text )
What percentage of people polled aligned with the Liberal party according to the August 2008 poll that reported 36% aligning with New Democratic party?
SELECT "Liberal" FROM table_14045 WHERE "New Democratic" = '36%' AND "Dates" = 'august 2008'
CREATE TABLE table_142573_1 ( clock_rate__mhz_ VARCHAR, bandwidth__mb_s_ VARCHAR )
Name the number of clock rate mhz when bandwidth mb/s is 2400
SELECT COUNT(clock_rate__mhz_) FROM table_142573_1 WHERE bandwidth__mb_s_ = 2400
CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TA...
Currently Protected Questions, simple search.
SELECT ph.PostId AS "post_link", ph.CreationDate AS "protected_date", CASE ph.UserId WHEN NULL THEN ph.UserDisplayName ELSE ph.UserId END AS "user_link" FROM PostHistory AS ph WHERE ph.PostHistoryTypeId = 19 ORDER BY ph.PostId, ph.CreationDate
CREATE TABLE table_64012 ( "Serial No." real, "District" text, "Headquartered City" text, "City Population (2009)" real, "City Area(km 2 )" real )
What district was the city with an area smaller than 12 square kilometers and a serial number of 35?
SELECT "District" FROM table_64012 WHERE "City Area(km 2 )" < '12' AND "Serial No." = '35'
CREATE TABLE table_70335 ( "Race" real, "Circuit" text, "Location / State" text, "Date" text, "Winner" text, "Team" text )
How many races were in the Mallala Motor Sport Park circuit?
SELECT COUNT("Race") FROM table_70335 WHERE "Circuit" = 'mallala motor sport park'
CREATE TABLE company ( Company_ID real, Name text, Headquarters text, Industry text, Sales_in_Billion real, Profits_in_Billion real, Assets_in_Billion real, Market_Value_in_Billion real ) CREATE TABLE people ( People_ID int, Age int, Name text, Nationality text, Grad...
Return a bar chart about the number of companies for each industry.
SELECT Industry, COUNT(Industry) FROM company GROUP BY Industry
CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TA...
The distribution of answerer's reputation over the most recent N answers.
SELECT q.Id, q.CreationDate, u.Reputation FROM Posts AS q INNER JOIN Users AS u ON u.Id = q.OwnerUserId WHERE q.PostTypeId = 2 ORDER BY q.CreationDate DESC LIMIT 100
CREATE TABLE captain ( Captain_ID int, Name text, Ship_ID int, age text, Class text, Rank text ) CREATE TABLE Ship ( Ship_ID int, Name text, Type text, Built_Year real, Class text, Flag text )
A bar chart about how many captains are in each rank?, and could you order by the X-axis from high to low?
SELECT Rank, COUNT(*) FROM captain GROUP BY Rank ORDER BY Rank DESC
CREATE TABLE table_47955 ( "Date" text, "Region" text, "Label" text, "Catalogue" text, "Format" text )
What is Date, when Label is Jugoton?
SELECT "Date" FROM table_47955 WHERE "Label" = 'jugoton'
CREATE TABLE table_61081 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text )
What is the Tie no when Swansea City is the Away team with a Score of 2 2?
SELECT "Tie no" FROM table_61081 WHERE "Score" = '2–2' AND "Away team" = 'swansea city'
CREATE TABLE table_203_515 ( id number, "rank" number, "city" text, "passengers" number, "ranking" number, "airline" text )
how many more passengers flew to los angeles than to saskatoon from manzanillo airport in 2013 ?
SELECT (SELECT "passengers" FROM table_203_515 WHERE "city" = 'los angeles') - (SELECT "passengers" FROM table_203_515 WHERE "city" = 'saskatoon')
CREATE TABLE table_25129482_1 ( capacity INTEGER )
What is the largest capacity for a stadium?
SELECT MAX(capacity) FROM table_25129482_1
CREATE TABLE table_4545 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
Where did Geelong play as the away team?
SELECT "Venue" FROM table_4545 WHERE "Away team" = 'geelong'
CREATE TABLE days ( days_code varchar, day_name varchar ) CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE flight_leg ( flight_id int, ...
list all the takeoffs and landings at MKE
SELECT DISTINCT flight.flight_id FROM airport AS AIRPORT_0, airport AS AIRPORT_1, flight WHERE (flight.to_airport = AIRPORT_0.airport_code AND AIRPORT_0.airport_code = 'MKE') OR (flight.from_airport = AIRPORT_1.airport_code AND AIRPORT_1.airport_code = 'MKE')
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, ...
until 2104 what are the five most common diagnoses that patients are given within the same month after being diagnosed with convulsions nec?
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions...
CREATE TABLE table_74160 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
Where was the game and what was the attendance on April 3?
SELECT "Location Attendance" FROM table_74160 WHERE "Date" = 'April 3'
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
tell me the number of patients with lab test item id 50802 who had delta abnormal lab test status.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "50802" AND lab.flag = "delta"
CREATE TABLE table_4653 ( "Race Name" text, "Circuit" text, "City/Location" text, "Date" text, "Pole position" text, "Winning driver" text, "Winning team" text, "Report" text )
For the race Champion Spark Plug 300, what is the report?
SELECT "Report" FROM table_4653 WHERE "Race Name" = 'champion spark plug 300'
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime...
what was the name of the medicine patient 013-28507 was prescribed during the same day after having received a cpap/peep therapy - 5-10 cm h2o procedure in their current hospital encounter?
SELECT t2.drugname FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-28507' AND patient.hospitaldi...
CREATE TABLE table_21330 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location/Attendance" text, "Record" text )
If the score is 62-70, what are the high points?
SELECT "High points" FROM table_21330 WHERE "Score" = '62-70'
CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar ) CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE program_requirement ( program_id int, category varchar, min_cred...
Are there Friday classes for SM 470 ?
SELECT DISTINCT course_offering.friday FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE course.department = 'SM' AND course.number = 470 AND semester.semester = 'WN' AND semester.year = 2016
CREATE TABLE table_38441 ( "Year" real, "Starts" real, "Wins" real, "Top 5" real, "Top 10" real, "Poles" real, "Avg. Start" real, "Avg. Finish" real, "Winnings" text, "Position" text )
How many Top 10s have Wins larger than 0, and Poles larger than 0?
SELECT COUNT("Top 10") FROM table_38441 WHERE "Wins" > '0' AND "Poles" > '0'
CREATE TABLE table_8614 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Record" text, "Attendance" text )
What was the result of the game after week 6 against the cleveland browns?
SELECT "Result" FROM table_8614 WHERE "Week" < '6' AND "Opponent" = 'cleveland browns'
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREA...
since 1 year ago, patient 029-30149 has undergone a procedure?
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '029-30149')) AND DATETIME(treatment.treatmenttime) >= DATETIME(CURRENT_TIME(...
CREATE TABLE table_name_87 ( swimsuit INTEGER, interview VARCHAR, average VARCHAR )
Which smallest swimsuit number's interview was less than 8.574 when the average number was bigger than 8.532?
SELECT MIN(swimsuit) FROM table_name_87 WHERE interview < 8.574 AND average > 8.532
CREATE TABLE table_name_4 ( tournament VARCHAR, wins VARCHAR, top_5 VARCHAR, top_25 VARCHAR )
Name the tournament for top-5 more thn 1 and top-25 of 13 with wins of 3
SELECT tournament FROM table_name_4 WHERE top_5 > 1 AND top_25 = 13 AND wins = 3
CREATE TABLE table_name_89 ( nationality VARCHAR, position VARCHAR, years_for_grizzlies VARCHAR )
What was the nationality of a point guard position in 1999-2001?
SELECT nationality FROM table_name_89 WHERE position = "point guard" AND years_for_grizzlies = "1999-2001"
CREATE TABLE table_20037 ( "Position" real, "Team" text, "Points" real, "Played" real, "Won" real, "Drawn" real, "Lost" real, "For" real, "Against" real, "Difference" text )
What is the highest number won with a difference of 1?
SELECT MAX("Won") FROM table_20037 WHERE "Difference" = '1'
CREATE TABLE table_55433 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
what is the laps when the driver is tony rolt and the grid is less than 10?
SELECT SUM("Laps") FROM table_55433 WHERE "Driver" = 'tony rolt' AND "Grid" < '10'
CREATE TABLE table_53386 ( "Constructor" text, "Chassis" text, "Engine" text, "Tyre" text, "Driver" text, "Rounds" text )
Who drove the car with the n175 chassis in round 13?
SELECT "Driver" FROM table_53386 WHERE "Chassis" = 'n175' AND "Rounds" = '13'
CREATE TABLE purchase ( member_id number, branch_id text, year text, total_pounds number ) CREATE TABLE membership_register_branch ( member_id number, branch_id text, register_year text ) CREATE TABLE branch ( branch_id number, name text, open_year text, address_road text, ...
How many total pounds were purchased in the year 2018 at all London branches?
SELECT SUM(total_pounds) FROM purchase AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T2.city = 'London' AND T1.year = 2018
CREATE TABLE table_name_69 ( model_number VARCHAR, part_number_s_ VARCHAR )
What model number has part number cl8064701510101?
SELECT model_number FROM table_name_69 WHERE part_number_s_ = "cl8064701510101"
CREATE TABLE repair ( repair_ID int, name text, Launch_Date text, Notes text ) CREATE TABLE technician ( technician_id real, Name text, Team text, Starting_Year real, Age int ) CREATE TABLE machine ( Machine_ID int, Making_Year int, Class text, Team text, Machin...
Give me a histogram for what are the names of the technicians and how many machines are they assigned to repair?, display the total number in ascending order.
SELECT Name, COUNT(*) FROM repair_assignment AS T1 JOIN technician AS T2 ON T1.technician_id = T2.technician_id GROUP BY T2.Name ORDER BY COUNT(*)
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TAB...
count the number of patients who received their sputum, tracheal specimen microbiology test since 2103.
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT microlab.patientunitstayid FROM microlab WHERE microlab.culturesite = 'sputum, tracheal specimen' AND STRFTIME('%y', microlab.culturetakentime) >= '2103')
CREATE TABLE table_name_16 ( team VARCHAR, position VARCHAR, pick VARCHAR )
What is Team, when Position is 'LHP', and when Pick is '23'?
SELECT team FROM table_name_16 WHERE position = "lhp" AND pick = 23
CREATE TABLE table_name_20 ( total_matches VARCHAR, year VARCHAR )
How many Total matches happened in 2003?
SELECT total_matches FROM table_name_20 WHERE year = "2003"
CREATE TABLE table_30153 ( "State Rank" real, "National Rank" real, "Institution" text, "Location" text, "Public or Private" text, "Endowment Funds" text, "Percentage Change YOY" text )
Name the total number of rank for percentage change yoy 13.1%
SELECT COUNT("National Rank") FROM table_30153 WHERE "Percentage Change YOY" = '13.1%'
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE...
For all employees who have the letters D or S in their first name, a line chart shows the change of salary over hire_date, and could you sort HIRE_DATE from high to low order?
SELECT HIRE_DATE, SALARY FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY HIRE_DATE DESC
CREATE TABLE medication ( code number, name text, brand text, description text ) CREATE TABLE nurse ( employeeid number, name text, position text, registered boolean, ssn number ) CREATE TABLE procedures ( code number, name text, cost number ) CREATE TABLE trained_in (...
What procedures cost less than 5000 and have John Wen as a trained physician?
SELECT name FROM procedures WHERE cost < 5000 INTERSECT SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen"
CREATE TABLE table_11604804_5 ( founded INTEGER, nickname VARCHAR )
What is the founding of parsu cimmarons?
SELECT MIN(founded) FROM table_11604804_5 WHERE nickname = "ParSU Cimmarons"
CREATE TABLE table_204_488 ( id number, "order in\nposition" number, "president of\nthe republic" text, "length of\nthe presidential\naction" text, "rank by\nlength\nof term(s)" number, "notes" text )
who served a term before mannerheim ?
SELECT "president of\nthe republic" FROM table_204_488 WHERE "order in\nposition" < (SELECT "order in\nposition" FROM table_204_488 WHERE "president of\nthe republic" = 'gustaf mannerheim') ORDER BY "order in\nposition" DESC LIMIT 1
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, ...
what is average age of patients whose discharge location is home health care and primary disease is angioedema?
SELECT AVG(demographic.age) FROM demographic WHERE demographic.discharge_location = "HOME HEALTH CARE" AND demographic.diagnosis = "ANGIOEDEMA"
CREATE TABLE table_19435 ( "School Year" text, "Class A" text, "Class AA" text, "Class AAA" text, "Class AAAA" text, "Class AAAAA" text )
For franklin of class aa, which school years does this occur?
SELECT "School Year" FROM table_19435 WHERE "Class AA" = 'Franklin'
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugsto...
when did patient 031-3355 get the last other microbiology test on the current hospital encounter.
SELECT microlab.culturetakentime FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-3355' AND patient.hospitaldischargetime IS NULL)) AND microla...
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
what is the procedure short title and long title of procedure icd9 code 45?
SELECT procedures.short_title, procedures.long_title FROM procedures WHERE procedures.icd9_code = "45"
CREATE TABLE table_68868 ( "Rank" text, "Score" text, "Player" text, "Club" text, "Opponent" text, "Year" text, "Round" text, "Venue" text )
Who is the opponent in 1992?
SELECT "Opponent" FROM table_68868 WHERE "Year" = '1992'
CREATE TABLE table_14265 ( "Year" real, "Competition" text, "Location" text, "Weight Category" text, "Snatch" text, "Clean and Jerk" text, "Total" text, "Place" real )
What was the highest place result in 2010 with a Clean and Jerk weight of 224kg?
SELECT MAX("Place") FROM table_14265 WHERE "Year" = '2010' AND "Clean and Jerk" = '224kg'
CREATE TABLE table_60614 ( "English translation" text, "Original album" text, "Lyricist(s)" text, "Composer(s)" text, "Time" text )
What is Original Album, when English Translation is 'With You'?
SELECT "Original album" FROM table_60614 WHERE "English translation" = 'with you'
CREATE TABLE phone ( Accreditation_level VARCHAR )
Find the accreditation level that more than 3 phones use.
SELECT Accreditation_level FROM phone GROUP BY Accreditation_level HAVING COUNT(*) > 3
CREATE TABLE climber ( Climber_ID int, Name text, Country text, Time text, Points real, Mountain_ID int ) CREATE TABLE mountain ( Mountain_ID int, Name text, Height real, Prominence real, Range text, Country text )
A bar chart for what are the number of the countries of mountains with height bigger than 5000?, could you show in descending by the Country?
SELECT Country, COUNT(Country) FROM mountain WHERE Height > 5000 GROUP BY Country ORDER BY Country DESC
CREATE TABLE table_name_32 ( tail_number VARCHAR, fatalities VARCHAR )
What was the tail number with 3/3 fatalities?
SELECT tail_number FROM table_name_32 WHERE fatalities = "3/3"
CREATE TABLE table_20331 ( "No." real, "Name" text, "Livery" text, "Locomotive type" text, "Wheel Arrangement" text, "Builder" text, "Year built" real, "Status" text )
How many locomotives have a livery that is highland railway green
SELECT COUNT("Name") FROM table_20331 WHERE "Livery" = 'Highland Railway green'
CREATE TABLE table_27615445_1 ( episode_air_date VARCHAR, guest_fourth_judge VARCHAR )
List all episode air dates where Luiza Possi was the guest fourth judge?
SELECT episode_air_date FROM table_27615445_1 WHERE guest_fourth_judge = "Luiza Possi"
CREATE TABLE table_35023 ( "Game" real, "March" real, "Opponent" text, "Score" text, "Record" text, "Points" real )
Game smaller than 70, and a Record of 43 16 8 is what opponent?
SELECT "Opponent" FROM table_35023 WHERE "Game" < '70' AND "Record" = '43–16–8'
CREATE TABLE table_name_97 ( score VARCHAR, home VARCHAR )
What was the score of the game with the Broadview Hawks as the home team?
SELECT score FROM table_name_97 WHERE home = "broadview hawks"
CREATE TABLE people ( People_ID int, District text, Name text, Party text, Age int ) CREATE TABLE debate_people ( Debate_ID int, Affirmative int, Negative int, If_Affirmative_Win bool ) CREATE TABLE debate ( Debate_ID int, Date text, Venue text, Num_of_Audience int ...
Show the number of debates for each person on the affirmative side in a bar chart, and order by the total number in desc please.
SELECT Name, COUNT(Name) FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Affirmative = T3.People_ID GROUP BY Name ORDER BY COUNT(Name) DESC
CREATE TABLE table_11630008_4 ( season_no INTEGER, written_by VARCHAR )
What is the first season written by joseph hampton & dani renee?
SELECT MIN(season_no) FROM table_11630008_4 WHERE written_by = "Joseph Hampton & Dani Renee"
CREATE TABLE table_203_538 ( id number, "flight" text, "date" text, "payload nickname" text, "payload" text, "orbit" text, "result" text )
how many partial failures of h ii flights were there ?
SELECT COUNT(*) FROM table_203_538 WHERE "result" = 'partial failure'
CREATE TABLE table_name_49 ( pick__number VARCHAR, round VARCHAR )
What is Pick #, when Round is '10'?
SELECT pick__number FROM table_name_49 WHERE round = 10
CREATE TABLE table_203_834 ( id number, "rank" number, "census subdivision" text, "province" text, "type" text, "land area\n(km2, 2011)" number, "population 2011" number, "population 2006" number, "population 2001" number, "population 1996" number, "change in % 2006-2011" num...
what was the total population of the five largest cities in the province of ontario in 2006 ?
SELECT SUM("population 2006") FROM table_203_834 WHERE id IN (SELECT id FROM table_203_834 WHERE "province" = 'ontario' ORDER BY "population 2006" DESC LIMIT 5)
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, ...
how many of the patients admitted to emergency had icd9 code 5185?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND procedures.icd9_code = "5185"
CREATE TABLE table_69265 ( "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text )
Name the opponent with score of 1 6, 6 4, 6 4
SELECT "Opponent" FROM table_69265 WHERE "Score" = '1–6, 6–4, 6–4'
CREATE TABLE table_31634 ( "Conference" text, "# of Bids" real, "Record" text, "Win %" text, "Round of 32" text, "Elite Eight" text, "Final Four" text, "Championship Game" text )
How many elite eight teams came from the Atlantic 10?
SELECT "Elite Eight" FROM table_31634 WHERE "Conference" = 'atlantic 10'
CREATE TABLE table_5930 ( "Country" text, "Project Name" text, "Year startup" text, "Operator" text, "Peak" text )
What was the startup year for the project with a nioc operator?
SELECT "Year startup" FROM table_5930 WHERE "Operator" = 'nioc'
CREATE TABLE table_37155 ( "Season" real, "Series" text, "Team Name" text, "Races" text, "Wins" text, "Poles" text, "F/Laps" text, "Podiums" text, "Points" text, "Final Placing" text )
Which Team Name has Poles of 0, and a Final Placing of 29th?
SELECT "Team Name" FROM table_37155 WHERE "Poles" = '0' AND "Final Placing" = '29th'
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CRE...
what was the name of the drug patient 033-42758 was prescribed within 2 days after receiving a sedative agent - propofol in the first hospital encounter?
SELECT t2.drugname FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '033-42758' AND NOT patient.hospit...
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE lab ( labid numbe...
what was the total amount of output for patient 002-35416 on 05/06/last year?
SELECT SUM(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-35416')) AND intakeoutput.cellpath LIKE '%ou...
CREATE TABLE table_name_17 ( result VARCHAR, score VARCHAR, venue VARCHAR, date VARCHAR )
What was the result at dakar , senegal, on 3 september 2011, and with a Score of 2 0?
SELECT result FROM table_name_17 WHERE venue = "dakar , senegal" AND date = "3 september 2011" AND score = "2–0"
CREATE TABLE table_20280 ( "Name" text, "Overs Bowled" text, "Maidens" real, "Runs Conceded" real, "Wickets" real, "Extras" real, "E.R." text )
How many runs conceded for chaminda vaas?
SELECT "Runs Conceded" FROM table_20280 WHERE "Name" = 'Chaminda Vaas'
CREATE TABLE train ( id int, train_number int, name text, origin text, destination text, time text, interval text ) CREATE TABLE weekly_weather ( station_id int, day_of_week text, high_temperature int, low_temperature int, precipitation real, wind_speed_mph int ) CR...
Group by the local authorities and count the number of local authorities, and then group by services, could you rank by the Y in desc?
SELECT services, COUNT(services) FROM station GROUP BY local_authority, services ORDER BY COUNT(services) DESC
CREATE TABLE table_25468520_1 ( printing_process VARCHAR, theme VARCHAR )
How many time is the theme rotary international : 100 years in canada?
SELECT COUNT(printing_process) FROM table_25468520_1 WHERE theme = "Rotary International : 100 Years in Canada"
CREATE TABLE table_64198 ( "Province" text, "Inhabitants" real, "established" real, "President" text, "Party" text, "Election" real )
What was the lowest election result for President Leonardo Marras with an area smaller than 227,063 people?
SELECT MIN("Election") FROM table_64198 WHERE "President" = 'leonardo marras' AND "Inhabitants" < '227,063'
CREATE TABLE table_name_26 ( départ_de_la_main_gauche VARCHAR, mode VARCHAR )
What is the Depart de la main gauche of the do Mode?
SELECT départ_de_la_main_gauche FROM table_name_26 WHERE mode = "do"
CREATE TABLE table_name_8 ( molecules VARCHAR, percent_of_mass VARCHAR )
what is the molecules when the percent mass is 1.0?
SELECT molecules FROM table_name_8 WHERE percent_of_mass = "1.0"
CREATE TABLE table_13705 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Opponent in the final" text, "Score in the final" text )
What is the score in the final of the tournament with a clay surface on 18 April 2011?
SELECT "Score in the final" FROM table_13705 WHERE "Surface" = 'clay' AND "Date" = '18 april 2011'
CREATE TABLE table_51072 ( "Date" text, "Distance" text, "Handler" text, "Event" text, "Location" text )
Which event has a distance of ft10in (m)?
SELECT "Event" FROM table_51072 WHERE "Distance" = 'ft10in (m)'