table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
⌀
CREATE TABLE School ( School_id text, School_name text, Location text, Mascot text, Enrollment int, IHSAA_Class text, IHSAA_Football_Class text, County text ) CREATE TABLE endowment ( endowment_id int, School_id int, donator_name text, amount real ) CREATE TABLE budget ...
Return a bar chart showing the number of schools in each county.
SELECT County, COUNT(*) FROM School GROUP BY County
CREATE TABLE table_22753439_1 ( margin VARCHAR, winner VARCHAR )
How many margins have a winner of S. Singaravadivel?
SELECT COUNT(margin) FROM table_22753439_1 WHERE winner = "S. Singaravadivel"
CREATE TABLE table_name_17 ( played INTEGER, drawn VARCHAR, against VARCHAR )
What is the average played that has a drawn greater than 1, with an against greater than 16?
SELECT AVG(played) FROM table_name_17 WHERE drawn > 1 AND against > 16
CREATE TABLE table_57819 ( "Date" text, "Tournament" text, "Surface" text, "Opponent in the final" text, "Score" text )
Which tournament had Toshiaki Sakai as an opponent in the final on a grass surface?
SELECT "Tournament" FROM table_57819 WHERE "Opponent in the final" = 'toshiaki sakai' AND "Surface" = 'grass'
CREATE TABLE table_67265 ( "Title" text, "Studio" text, "Role" text, "Leading lady" text, "Director" text )
Who directed the movie The Star Packer?
SELECT "Director" FROM table_67265 WHERE "Title" = 'the star packer'
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
get me the number of patients on ih route of drug administration who have diagnoses of pneumonia, unspecified organism.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Pneumonia, organism NOS" AND prescriptions.route = "IH"
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid num...
did patient 025-32034 have a sao2 that was greater than 100.0 on this month/07?
SELECT COUNT(*) > 0 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-32034')) AND vitalperiodic.sao2 > 100.0 AND NOT vitalperiodic.sa...
CREATE TABLE table_56693 ( "Year" real, "Champion" text, "Score" text, "Runner-Up" text, "Location" text, "Semi-Finalist #1" text, "Semi-Finalist #2" text )
Who was champion in 2005 where the semi-finalist was #1 in western Carolina?
SELECT "Champion" FROM table_56693 WHERE "Year" = '2005' AND "Semi-Finalist #1" = 'western carolina'
CREATE TABLE products ( code number, name text, price number, manufacturer number ) CREATE TABLE manufacturers ( code number, name text, headquarter text, founder text, revenue number )
How many products are not made by Sony?
SELECT COUNT(DISTINCT name) FROM products WHERE NOT name IN (SELECT T1.name FROM products AS T1 JOIN manufacturers AS T2 ON T1.manufacturer = T2.code WHERE T2.name = 'Sony')
CREATE TABLE table_23480 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
how many high points where date is february 19
SELECT COUNT("High points") FROM table_23480 WHERE "Date" = 'February 19'
CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE offering_instructor ( ...
For BIOPHYS 280 and 115 , what are the prerequisites ?
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE (COURSE_1.number = 280 OR COURSE_1.number = 115) AND COURSE_0.course_id = course_prerequisite.pre_course_id AND COURSE_1.course_id = course_prerequisite.course_id AND COURSE_1.depar...
CREATE TABLE table_name_96 ( team_2 VARCHAR )
For a team 2 of Al-Faisaly, what was the 2nd leg?
SELECT 2 AS nd_leg FROM table_name_96 WHERE team_2 = "al-faisaly"
CREATE TABLE table_72613 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Record" text, "Game Site" text, "Attendance" real )
When 74804 is the attendance what week is it?
SELECT "Week" FROM table_72613 WHERE "Attendance" = '74804'
CREATE TABLE manufacturers ( code number, name text, headquarter text, founder text, revenue number ) CREATE TABLE products ( code number, name text, price number, manufacturer number )
What are the average, maximum and total revenues of all companies?
SELECT AVG(revenue), MAX(revenue), SUM(revenue) FROM manufacturers
CREATE TABLE wine ( No INTEGER, Grape TEXT, Winery TEXT, Appelation TEXT, State TEXT, Name TEXT, Year INTEGER, Price INTEGER, Score INTEGER, Cases INTEGER, Drink TEXT ) CREATE TABLE appellations ( No INTEGER, Appelation TEXT, County TEXT, State TEXT, Area...
Give the neames of wines with prices below 50 and with appelations in Monterey county, and count them by a bar chart, sort y-axis from high to low order please.
SELECT Name, COUNT(Name) FROM appellations AS T1 JOIN wine AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = "Monterey" AND T2.Price < 50 GROUP BY Name ORDER BY COUNT(Name) DESC
CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, pro...
what ground transportation is available in PITTSBURGH
SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'PITTSBURGH' AND ground_service.city_code = city.city_code
CREATE TABLE trust ( source_u_id number, target_u_id number, trust number ) CREATE TABLE review ( a_id number, u_id number, i_id number, rating number, rank number ) CREATE TABLE item ( i_id number, title text ) CREATE TABLE useracct ( u_id number, name text )
Find the number of items that did not receive any review.
SELECT COUNT(*) FROM item WHERE NOT i_id IN (SELECT i_id FROM review)
CREATE TABLE table_55398 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
Luxembourg received how many gold medals?
SELECT AVG("Gold") FROM table_55398 WHERE "Nation" = 'luxembourg'
CREATE TABLE table_9918 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
What is the place of plyaer Tim Herron from the United States with a to par of +1?
SELECT "Place" FROM table_9918 WHERE "Country" = 'united states' AND "To par" = '+1' AND "Player" = 'tim herron'
CREATE TABLE table_61816 ( "Perpetrator" text, "Date" text, "Year" real, "Location" text, "Country" text, "Killed" real, "Additional Notes" text )
What are the additional notes for Cotabato?
SELECT "Additional Notes" FROM table_61816 WHERE "Location" = 'cotabato'
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE pr...
calculate the number of patients who have been prescribed magnesium sulfate (ob).
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT prescriptions.hadm_id FROM prescriptions WHERE prescriptions.drug = 'magnesium sulfate (ob)')
CREATE TABLE table_54010 ( "Year" text, "TCKL" real, "SACK" real, "P/KO RET" real, "YARDS" real )
What is the total of all YARDS with 0 SACK and less than 14 P/KO RET?
SELECT COUNT("YARDS") FROM table_54010 WHERE "SACK" = '0' AND "P/KO RET" < '14'
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREAT...
tell me the name of the allergy patient 006-42293 has since 51 months ago?
SELECT allergy.allergyname FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-42293')) AND DATETIME(allergy.allergytime) >= DATETIME(CURRENT_TIME()...
CREATE TABLE table_name_71 ( week VARCHAR, game_site VARCHAR, attendance VARCHAR )
What week was the game played at Robert f. Kennedy memorial stadium with more than 54,633 people in attendance?
SELECT COUNT(week) FROM table_name_71 WHERE game_site = "robert f. kennedy memorial stadium" AND attendance > 54 OFFSET 633
CREATE TABLE table_75713 ( "Week #" text, "Theme" text, "Original artist" text, "Order #" text, "Result" text )
What is the order number that has top 20 (10 women) as the week number?
SELECT "Order #" FROM table_75713 WHERE "Week #" = 'top 20 (10 women)'
CREATE TABLE table_name_5 ( circuit VARCHAR, race VARCHAR )
What circuit was for the german grand prix?
SELECT circuit FROM table_name_5 WHERE race = "german grand prix"
CREATE TABLE table_67073 ( "Division" text, "Drawn" real, "Lost" real, "Points" real, "League Pos" text )
What is the drawn result with a league position of 15th and a lost result that is more than 17?
SELECT SUM("Drawn") FROM table_67073 WHERE "League Pos" = '15th' AND "Lost" > '17'
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, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions...
what is discharge time of subject id 3343?
SELECT demographic.dischtime FROM demographic WHERE demographic.subject_id = "3343"
CREATE TABLE table_44715 ( "Team" text, "Average" real, "Points" real, "Played" real, "2006" text, "2007" text, "2008" text )
What is the sum of Average, when 2006 is '36/40', and when Played is greater than 126?
SELECT SUM("Average") FROM table_44715 WHERE "2006" = '36/40' AND "Played" > '126'
CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text...
Show me about the distribution of meter_600 and ID in a bar chart, and rank by the meter_600 from high to low.
SELECT meter_600, ID FROM swimmer ORDER BY meter_600 DESC
CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varch...
Do you know who the teacher is for INTLSTD 401 ?
SELECT DISTINCT instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'INTLSTD' AND course.number = 401 AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offerin...
CREATE TABLE table_30459 ( "Series #" real, "Title" text, "Written by" text, "Directed by" text, "Original air date" text, "Production code" text, "U.S. viewers (millions)" text )
What date did 'The runner' originally air on?
SELECT "Original air date" FROM table_30459 WHERE "Title" = 'The Runner'
CREATE TABLE wine ( No INTEGER, Grape TEXT, Winery TEXT, Appelation TEXT, State TEXT, Name TEXT, Year INTEGER, Price INTEGER, Score INTEGER, Cases INTEGER, Drink TEXT ) CREATE TABLE appellations ( No INTEGER, Appelation TEXT, County TEXT, State TEXT, Area...
Bar graph to show how many year from different year, and rank y-axis from low to high order.
SELECT Year, COUNT(Year) FROM wine ORDER BY COUNT(Year)
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 minimum age of patients whose gender is f and primary disease is congestive heart failure?
SELECT MIN(demographic.age) FROM demographic WHERE demographic.gender = "F" AND demographic.diagnosis = "CONGESTIVE HEART FAILURE"
CREATE TABLE table_255205_1 ( joined VARCHAR, type VARCHAR )
How many joined this Private/Church of God institution?
SELECT joined FROM table_255205_1 WHERE type = "Private/Church of God"
CREATE TABLE table_name_34 ( nickname VARCHAR, division VARCHAR )
What is the nickname of the team in division 2?
SELECT nickname FROM table_name_34 WHERE division = "division 2"
CREATE TABLE table_name_22 ( performer VARCHAR, points VARCHAR )
Who scored 57 points?
SELECT performer FROM table_name_22 WHERE points = 57
CREATE TABLE table_28291 ( "Rank" real, "Average" text, "Player" text, "Matches" real, "Innings" real, "Period" text )
What is the lowest number of matches for a record holder?
SELECT MIN("Matches") FROM table_28291
CREATE TABLE table_69389 ( "Year" text, "Champion" text, "Runner-Up" text, "3rd Place" text, "Location" text )
Name the champion for 2000
SELECT "Champion" FROM table_69389 WHERE "Year" = '2000'
CREATE TABLE table_71708 ( "Rider" text, "Manufacturer" text, "Laps" real, "Time/Retired" text, "Grid" real )
What is the Manufacturer for simone corsi?
SELECT "Manufacturer" FROM table_71708 WHERE "Rider" = 'simone corsi'
CREATE TABLE table_21070 ( "Team #1" text, "Points" text, "Team #2" text, "1st leg" text, "2nd leg" text )
If team two is San Lorenzo, how many were on team one?
SELECT COUNT("Team #1") FROM table_21070 WHERE "Team #2" = 'San Lorenzo'
CREATE TABLE table_203_142 ( id number, "pos" text, "no" number, "rider" text, "bike" text, "laps" number, "time" text, "grid" number, "points" number )
in the 2007 phillip island superbike world championship round superbike race 1 classification what was the point difference between position 1 and 2 ?
SELECT (SELECT "points" FROM table_203_142 WHERE "pos" = 1) - (SELECT "points" FROM table_203_142 WHERE "pos" = 2)
CREATE TABLE table_name_62 ( attendance INTEGER, opponent VARCHAR, record VARCHAR )
What was the attendance when the Braves were the opponent and the record was 56-53?
SELECT AVG(attendance) FROM table_name_62 WHERE opponent = "braves" AND record = "56-53"
CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_proje...
Please show me the list of Dr. Daniel Brickman 's courses next semester .
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND instructor.name LIKE '%Daniel Brickman%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.o...
CREATE TABLE table_46755 ( "Team" text, "Outgoing manager" text, "Manner of departure" text, "Date of vacancy" text, "Replaced by" text, "Date of appointment" text, "Position in table" text )
What was the manner of departure for the vacancy date of 20 September 2009?
SELECT "Manner of departure" FROM table_46755 WHERE "Date of vacancy" = '20 september 2009'
CREATE TABLE table_name_47 ( top_5 INTEGER, wins VARCHAR, events VARCHAR )
Which Top-5 is the highest one that has Wins of 0, and Events larger than 6?
SELECT MAX(top_5) FROM table_name_47 WHERE wins = 0 AND events > 6
CREATE TABLE table_1636 ( "Period" text, "% trains arriving within 5 mins of scheduled time (over three months)" text, "Change over same quarter the previous year" text, "% trains arriving within 5 mins of scheduled time Moving Annual Average (MAA)" text, "Change over previous year as a whole" text ...
What's the change over same quarter the previous year in the period when the 89.6% of the trains arrive within 5 minutes of scheduled time (over three months)?
SELECT "Change over same quarter the previous year" FROM table_1636 WHERE "% trains arriving within 5 mins of scheduled time (over three months)" = '89.6%'
CREATE TABLE table_name_2 ( roll VARCHAR, area VARCHAR )
Which roll has an Area of mahia?
SELECT roll FROM table_name_2 WHERE area = "mahia"
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE i...
had patient 035-17122 been prescribed since 154 months ago furosemide inj, vitamins/minerals po tabs, or ecotrin?
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '035-17122')) AND medication.drugname IN ('furosemide inj', 'vitamins/miner...
CREATE TABLE table_78457 ( "League" text, "Sport" text, "Season" text, "Total attendance" text, "Average attendance" real )
What's the average attendance of the league with a total attendance of 2268508?
SELECT "Average attendance" FROM table_78457 WHERE "Total attendance" = '2268508'
CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number...
Users having Stack Exchange Inc. emails on their 'About me'. Email domains included: stackexchange.com and stackoverflow.com
SELECT Id AS "user_link", AboutMe, WebsiteUrl FROM Users WHERE (AboutMe LIKE '%@stackexchange.com%' OR AboutMe LIKE '%@stackoverflow.com%' OR AboutMe LIKE '%valued associate%')
CREATE TABLE table_204_385 ( id number, "round" number, "pick" number, "player" text, "nationality" text, "college/junior/club team" text )
are more of the amateur draft picks from canada or the united states ?
SELECT "nationality" FROM table_204_385 WHERE "nationality" IN ('canada', 'united states') GROUP BY "nationality" ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE table_35471 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Game site" text, "Attendance" real )
what week number was at memorial stadium?
SELECT AVG("Week") FROM table_35471 WHERE "Game site" = 'memorial stadium'
CREATE TABLE table_53447 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
How many people were in the crowd when the home team scored 31.9 (195)?
SELECT COUNT("Crowd") FROM table_53447 WHERE "Home team score" = '31.9 (195)'
CREATE TABLE table_17001658_6 ( team VARCHAR, game VARCHAR )
Against which team was game 21?
SELECT team FROM table_17001658_6 WHERE game = 21
CREATE TABLE table_73266 ( "Gas name" text, "Chemical formula" text, "Lifetime (years)" text, "20-yr" text, "100-yr" text, "500-yr" text )
What is the lifetime (years) for chemical formula ch 4?
SELECT "Lifetime (years)" FROM table_73266 WHERE "Chemical formula" = 'CH 4'
CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
For those employees who did not have any job in the past, draw a bar chart about the distribution of job_id and the average of employee_id , and group by attribute job_id, and I want to display total number from low to high order please.
SELECT JOB_ID, AVG(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY AVG(EMPLOYEE_ID)
CREATE TABLE status ( station_id INTEGER, bikes_available INTEGER, docks_available INTEGER, time TEXT ) CREATE TABLE weather ( date TEXT, max_temperature_f INTEGER, mean_temperature_f INTEGER, min_temperature_f INTEGER, max_dew_point_f INTEGER, mean_dew_point_f INTEGER, min_...
For those dates with a max temperature greater than or equal to 80, I want to see the number of days for each year using a bar chart.
SELECT date, COUNT(date) FROM weather WHERE max_temperature_f >= 80
CREATE TABLE table_43678 ( "Player" text, "Nationality" text, "Jersey Number(s)" text, "Position" text, "Years" text, "From" text )
What is the nationality of the person with number 27?
SELECT "Nationality" FROM table_43678 WHERE "Jersey Number(s)" = '27'
CREATE TABLE table_36847 ( "Year" real, "Class" text, "Team" text, "Points" real, "Wins" real )
What is the year that there were 0 wins, team AJS, and under 12 points?
SELECT COUNT("Year") FROM table_36847 WHERE "Wins" = '0' AND "Team" = 'ajs' AND "Points" < '12'
CREATE TABLE table_41510 ( "Player" text, "Country" text, "Year won" real, "Total" real, "To par" real )
What is the Total of the player who won before 1983 with a smaller than 4 To par?
SELECT COUNT("Total") FROM table_41510 WHERE "To par" < '4' AND "Year won" < '1983'
CREATE TABLE table_25548505_1 ( original_air_date VARCHAR, us_viewers__millions_ VARCHAR )
What was the original air date of the episode that had 5.30 million U.S. viewers?
SELECT original_air_date FROM table_25548505_1 WHERE us_viewers__millions_ = "5.30"
CREATE TABLE table_65771 ( "Year" real, "Competition" text, "Venue" text, "Position" text, "Event" text )
what is the venue when the competition is asian games, the event is 4x400 m relay and the year is 2002?
SELECT "Venue" FROM table_65771 WHERE "Competition" = 'asian games' AND "Event" = '4x400 m relay' AND "Year" = '2002'
CREATE TABLE table_name_82 ( save VARCHAR, opponent VARCHAR, date VARCHAR )
What is the save when Yankees are the opponents on July 25?
SELECT save FROM table_name_82 WHERE opponent = "yankees" AND date = "july 25"
CREATE TABLE table_5246 ( "Years" text, "Building" text, "City" text, "Height" text, "Storeys" real )
Which city contains Telus Plaza South?
SELECT "City" FROM table_5246 WHERE "Building" = 'telus plaza south'
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
count the number of patients who are diagnosed with gi obstruction / ileus - small bowel obstruction since 2 years ago.
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'gi obstruction / ileus - small bowel obstruction' AND DATETIME(diagnosis.diagnosistime) >= DATETIME(CURRENT_TIME(), '-2 year'))
CREATE TABLE table_name_90 ( total INTEGER, year_of_census VARCHAR, serbs VARCHAR )
What is the average total of the census after 1971 with 10,412 (32.88%) Serbs?
SELECT AVG(total) FROM table_name_90 WHERE year_of_census > 1971 AND serbs = "10,412 (32.88%)"
CREATE TABLE table_48553 ( "Round" real, "Pick" real, "Player" text, "Nationality" text, "College" text )
WHAT PLAYER HAS A PICK SMALLER THAN 110, AND DUKE AS COLLEGE?
SELECT "Player" FROM table_48553 WHERE "Pick" < '110' AND "College" = 'duke'
CREATE TABLE table_73016 ( "Year" real, "Illinois" text, "Indiana" text, "Kentucky" text, "Michigan" text, "Ohio" text, "Wisconsin" text )
What was the little league team from Kentucky when the little league team from Michigan was Grosse Pointe Farms-City LL Grosse Pointe Farms?
SELECT "Kentucky" FROM table_73016 WHERE "Michigan" = 'Grosse Pointe Farms-City LL Grosse Pointe Farms'
CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE...
what airlines are there
SELECT DISTINCT airline.airline_code FROM airline, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANC...
CREATE TABLE table_10706961_2 ( report VARCHAR, winning_team VARCHAR, pole_position VARCHAR )
How many reports are there in the race that Forsythe Racing won and Teo Fabi had the pole position in?
SELECT COUNT(report) FROM table_10706961_2 WHERE winning_team = "Forsythe Racing" AND pole_position = "Teo Fabi"
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 medication ( medi...
how many patients were diagnosed with respiratory acidosis - chronic and did not come to the hospital in the same month?
SELECT (SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'respiratory acidosis - chronic') AS t1) - (SELECT COUNT(DISTINCT t2.uniquepid) FROM (SELECT patient....
CREATE TABLE table_32243 ( "Rank" real, "Name" text, "Years" text, "Goals" real, "Apps" real )
What is the sum of rank with years 1996 2012 and apps greater than 340?
SELECT SUM("Rank") FROM table_32243 WHERE "Years" = '1996–2012' AND "Apps" > '340'
CREATE TABLE table_44558 ( "Poll Source" text, "Dates administered" text, "Democrat: Carl Levin" text, "Republican: Jack Hoogendyk" text, "Lead Margin" real )
What is Poll Source, when Democrat: Carl Levin is 61%?
SELECT "Poll Source" FROM table_44558 WHERE "Democrat: Carl Levin" = '61%'
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) 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 ...
indicate the daily minimum arterial bp mean of patient 13622 in 08/last year.
SELECT MIN(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 13622)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arte...
CREATE TABLE Tasks ( task_id INTEGER, project_id INTEGER, task_details VARCHAR(255), "eg Agree Objectives" VARCHAR(1) ) CREATE TABLE Projects ( project_id INTEGER, organisation_id INTEGER, project_details VARCHAR(255) ) CREATE TABLE Organisations ( organisation_id INTEGER, organisa...
Find the organisation ids and details of the organisations which are involved i Plot them as bar chart, show bars from low to high order please.
SELECT T2.organisation_details, T1.organisation_id FROM Grants AS T1 JOIN Organisations AS T2 ON T1.organisation_id = T2.organisation_id GROUP BY T2.organisation_details ORDER BY T2.organisation_details
CREATE TABLE table_201_13 ( id number, "city" text, "county(ies)" text, "population\n(2000 census)" number, "population\n(2010 census)" number, "class" text, "incorporation\ndate" number )
county has altoona and augusta ?
SELECT "county(ies)" FROM table_201_13 WHERE "city" = 'altoona'
CREATE TABLE table_17661 ( "Strongs #" text, "Hebrew word" text, "Strongs Transliteration" text, "Strongs Words Compounded" text, "English Spelling" text )
What is the hebrew word listed for strongs # 5418?
SELECT "Hebrew word" FROM table_17661 WHERE "Strongs #" = '5418'
CREATE TABLE table_57131 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
In the match as corio oval, who was the away team?
SELECT "Away team" FROM table_57131 WHERE "Venue" = 'corio oval'
CREATE TABLE table_45298 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text )
What methos did Keith Wisniewski use in the ufc fight night: teixeira vs. bader?
SELECT "Method" FROM table_45298 WHERE "Event" = 'ufc fight night: teixeira vs. bader'
CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) CREATE TABLE flight_stop ( flight_id int, stop_number int, ...
show flights from DENVER to OAKLAND
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'OAKLAND...
CREATE TABLE table_name_8 ( report VARCHAR, date VARCHAR )
What Report has the Date September 3, 2005?
SELECT report FROM table_name_8 WHERE date = "september 3, 2005"
CREATE TABLE table_name_80 ( director VARCHAR, role VARCHAR )
Which Director has a Role of melissa?
SELECT director FROM table_name_80 WHERE role = "melissa"
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
what is the number of patients whose age is less than 70 and lab test fluid is cerebrospinal fluid (csf)?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "70" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
CREATE TABLE table_name_54 ( silver INTEGER, total VARCHAR, bronze VARCHAR )
what is the highest silver when the total is 4 and bronze is less than 1?
SELECT MAX(silver) FROM table_name_54 WHERE total = "4" AND bronze < 1
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
how many patients under the age of 71 underwent procedure under icd9 code 5732?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "71" AND procedures.icd9_code = "5732"
CREATE TABLE table_67383 ( "7:00" text, "7:30" text, "8:00" text, "8:30" text, "9:00" text, "10:00" text )
What 7:00 has a 7:30 of w-five?
SELECT "7:00" FROM table_67383 WHERE "7:30" = 'w-five'
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemics...
what was the organism name found in this hospital encounter in patient 031-3355's last other microbiology test?
SELECT microlab.organism 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 microlab.cultur...
CREATE TABLE table_2409041_3 ( production_code VARCHAR, original_air_date VARCHAR )
How many production codes have an original airdate of November 16, 1990?
SELECT COUNT(production_code) FROM table_2409041_3 WHERE original_air_date = "November 16, 1990"
CREATE TABLE table_67134 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Record" text )
What was the score of the game when the record was 58 47?
SELECT "Score" FROM table_67134 WHERE "Record" = '58–47'
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NA...
For those employees who was hired before 2002-06-21, give me the comparison about the sum of salary over the job_id , and group by attribute job_id, and list bar from low to high order.
SELECT JOB_ID, SUM(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY JOB_ID
CREATE TABLE table_203_161 ( id number, "pos." text, "div." number, "no." number, "team" text, "drivers" text, "car" text, "laps" number, "qual.\npos." number )
who was phil ward racing 's other driver ?
SELECT "drivers" FROM table_203_161 WHERE "team" = 'phil ward racing' AND "drivers" <> 'phil ward'
CREATE TABLE table_48544 ( "Tournament" text, "2002" text, "2003" text, "2004" text, "2005" text, "2006" text, "2007" text, "2008" text, "2009" text, "2010" text, "Career SR" text, "Career W\u2013L" text )
What is the 2007 value for the 2006 wta premier tournaments?
SELECT "2007" FROM table_48544 WHERE "2006" = 'wta premier tournaments'
CREATE TABLE table_894 ( "District" real, "Incumbent" text, "Party" text, "Elected" real, "Status" text, "Opponent" text )
what was the lowest numbers for the winner gregory w. meeks
SELECT MIN("Elected") FROM table_894 WHERE "Incumbent" = 'Gregory W. Meeks'
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE d_icd_diag...
when was the first time that patient 85895 had the maximum chloride in a month before?
SELECT labevents.charttime FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 85895) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'chloride') AND DATETIME(labevents.charttime, 'start of month') = DATETIME(CURRE...
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic (...
Among patients admitted before 2114, for how many of them have a death status unspecified?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.expire_flag = "0" AND demographic.admityear < "2114"
CREATE TABLE table_name_72 ( area__km_2__ INTEGER, population__2000_ VARCHAR )
What is the smallest area with 45 population?
SELECT MIN(area__km_2__) FROM table_name_72 WHERE population__2000_ = "45"
CREATE TABLE table_name_37 ( object_type VARCHAR, ngc_number VARCHAR )
Which Object type has an NGC number of 2171?
SELECT object_type FROM table_name_37 WHERE ngc_number = 2171
CREATE TABLE table_name_24 ( Id VARCHAR )
what is 2010 when 2006 is 3r?
SELECT 2010 FROM table_name_24 WHERE 2006 = "3r"
CREATE TABLE table_name_35 ( tournament VARCHAR )
What is the 1976 value of the Australian Open?
SELECT 1976 FROM table_name_35 WHERE tournament = "australian open"