answer
stringlengths
6
3.91k
question
stringlengths
7
766
context
stringlengths
27
7.14k
SELECT margin_of_defeat FROM table_10753917_1 WHERE points = "30"
Which margin of defeats had points of 30?
CREATE TABLE table_10753917_1 ( margin_of_defeat VARCHAR, points VARCHAR )
SELECT MAX(no) FROM table_18424435_4
What is the maximum number of episodes in the series listed?
CREATE TABLE table_18424435_4 (no INTEGER)
SELECT T2.Winery FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.GRAPE = T2.GRAPE WHERE T1.Color = "White" GROUP BY T2.Winery ORDER BY COUNT(*) DESC LIMIT 3
Find the top 3 wineries with the greatest number of wines made of white color grapes.
CREATE TABLE GRAPES (GRAPE VARCHAR, Color VARCHAR); CREATE TABLE WINE (Winery VARCHAR, GRAPE VARCHAR)
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
Questions with No accepted answer where I have the highest score.
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...
SELECT COUNT(_number) FROM table_18424435_4 WHERE production_code = 306
What is the total number of episodes listed with a production code of 306?
CREATE TABLE table_18424435_4 (_number VARCHAR, production_code VARCHAR)
SELECT Grape, Winery, YEAR FROM WINE WHERE Price > 100 ORDER BY YEAR
List the grape, winery and year of the wines whose price is bigger than 100 ordered by year.
CREATE TABLE WINE (Grape VARCHAR, Winery VARCHAR, YEAR VARCHAR, Price INTEGER)
SELECT dob FROM table_name_40 WHERE surname = "cresswell"
Which DOB has a Surname of cresswell?
CREATE TABLE table_name_40 ( dob VARCHAR, surname VARCHAR )
SELECT directed_by FROM table_18424435_4 WHERE production_code = 301
Who directed the episode with a production code of 301?
CREATE TABLE table_18424435_4 (directed_by VARCHAR, production_code VARCHAR)
SELECT Grape, Appelation, Name FROM WINE WHERE Score > 93 ORDER BY Name
List the grape, appelation and name of wines whose score is higher than 93 ordered by Name.
CREATE TABLE WINE (Grape VARCHAR, Appelation VARCHAR, Name VARCHAR, Score INTEGER)
SELECT COUNT("Season premiere") FROM table_29636 WHERE "Viewers (in millions)" = '15.27'
How many season premieres had 15.27 million viewers?
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 )
SELECT written_by FROM table_18424435_3 WHERE canadian_viewers__million_ = "1.816"
Who wrote the episodes watched by 1.816 million people in Canada?
CREATE TABLE table_18424435_3 (written_by VARCHAR, canadian_viewers__million_ VARCHAR)
SELECT Appelation FROM WINE WHERE YEAR > 2008 EXCEPT SELECT Appelation FROM APPELLATIONS WHERE Area = "Central Coast"
Find the appelations that produce wines after the year of 2008 but not in Central Coast area.
CREATE TABLE WINE (Appelation VARCHAR, YEAR INTEGER, Area VARCHAR); CREATE TABLE APPELLATIONS (Appelation VARCHAR, YEAR INTEGER, Area VARCHAR)
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')
how many patients since 2105 have received a sputum, tracheal specimen microbiological test?
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...
SELECT written_by FROM table_18424435_3 WHERE canadian_viewers__million_ = "1.575"
Who wrote the episodes watched by 1.575 million people in Canada?
CREATE TABLE table_18424435_3 (written_by VARCHAR, canadian_viewers__million_ VARCHAR)
SELECT AVG(price) FROM wine WHERE NOT Appelation IN (SELECT T1.Appelation FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = 'Sonoma')
Find the average price of wines that are not produced from Sonoma county.
CREATE TABLE wine (price INTEGER, Appelation VARCHAR); CREATE TABLE APPELLATIONS (Appelation VARCHAR, County VARCHAR); CREATE TABLE WINE (Appelation VARCHAR)
SELECT county FROM table_name_36 WHERE mascot = "pacers"
Which County has a Mascot of pacers?
CREATE TABLE table_name_36 ( county VARCHAR, mascot VARCHAR )
SELECT directed_by FROM table_18424435_3 WHERE us_air_date = "February 27, 2009"
Who directed the episode aired on February 27, 2009?
CREATE TABLE table_18424435_3 (directed_by VARCHAR, us_air_date VARCHAR)
SELECT T1.County FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T2.Score > 90 GROUP BY T1.County ORDER BY COUNT(*) DESC LIMIT 1
Find the county where produces the most number of wines with score higher than 90.
CREATE TABLE WINE (Appelation VARCHAR, Score INTEGER); CREATE TABLE APPELLATIONS (County VARCHAR, Appelation VARCHAR)
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
when was patient 20693's first operation since 3 years ago?
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...
SELECT title FROM table_18424435_3 WHERE production_code = 217
Which episodes had production code 217?
CREATE TABLE table_18424435_3 (title VARCHAR, production_code VARCHAR)
SELECT COUNT(*) FROM station
How many train stations are there?
CREATE TABLE station (Id VARCHAR)
SELECT "Crowd" FROM table_78481 WHERE "Home team" = 'st kilda'
During st kilda's home game, what was the number of people in the crowd?
CREATE TABLE table_78481 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
SELECT median_house__hold_income FROM table_1840495_2 WHERE place = "Upper Arlington"
For upper Arlington, what was the median household income?
CREATE TABLE table_1840495_2 (median_house__hold_income VARCHAR, place VARCHAR)
SELECT name, LOCATION, number_of_platforms FROM station
Show the name, location, and number of platforms for all stations.
CREATE TABLE station (name VARCHAR, LOCATION VARCHAR, number_of_platforms VARCHAR)
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) ...
Automation Test Engineer - Lisbon.
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...
SELECT COUNT(number_of_households) FROM table_1840495_2 WHERE per_capita_income = "$30,298"
With a per capita income of $30,298, what was the total number of households?
CREATE TABLE table_1840495_2 (number_of_households VARCHAR, per_capita_income VARCHAR)
SELECT DISTINCT LOCATION FROM station
What are all locations of train stations?
CREATE TABLE station (LOCATION VARCHAR)
SELECT MIN("Gold") FROM table_50302 WHERE "Silver" = '0' AND "Bronze" = '2'
What is the lowest Gold, when Silver is 0, and when Bronze is 2?
CREATE TABLE table_50302 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
SELECT median_house__hold_income FROM table_1840495_2 WHERE population = 2188
If the population is 2188, what was the median household income?
CREATE TABLE table_1840495_2 (median_house__hold_income VARCHAR, population VARCHAR)
SELECT name, total_passengers FROM station WHERE LOCATION <> 'London'
Show the names and total passengers for all train stations not in London.
CREATE TABLE station (name VARCHAR, total_passengers VARCHAR, LOCATION VARCHAR)
SELECT "Liberal" FROM table_14045 WHERE "New Democratic" = '36%' AND "Dates" = 'august 2008'
What percentage of people polled aligned with the Liberal party according to the August 2008 poll that reported 36% aligning with New Democratic party?
CREATE TABLE table_14045 ( "Polling firm" text, "Dates" text, "Prog. Cons." text, "New Democratic" text, "Liberal" text )
SELECT per_capita_income FROM table_1840495_2 WHERE place = "Pigeon Creek"
For Pigeon Creek what is the per capita income?
CREATE TABLE table_1840495_2 (per_capita_income VARCHAR, place VARCHAR)
SELECT name, main_services FROM station ORDER BY total_passengers DESC LIMIT 3
Show the names and main services for train stations that have the top three total number of passengers.
CREATE TABLE station (name VARCHAR, main_services VARCHAR, total_passengers VARCHAR)
SELECT COUNT(clock_rate__mhz_) FROM table_142573_1 WHERE bandwidth__mb_s_ = 2400
Name the number of clock rate mhz when bandwidth mb/s is 2400
CREATE TABLE table_142573_1 ( clock_rate__mhz_ VARCHAR, bandwidth__mb_s_ VARCHAR )
SELECT per_capita_income FROM table_1840495_2 WHERE median_house__hold_income = "$57,407"
If the median income is $57,407, what is the per capita income?
CREATE TABLE table_1840495_2 (per_capita_income VARCHAR, median_house__hold_income VARCHAR)
SELECT AVG(total_passengers), MAX(total_passengers) FROM station WHERE LOCATION = 'London' OR LOCATION = 'Glasgow'
What is the average and maximum number of total passengers for train stations in London or Glasgow?
CREATE TABLE station (total_passengers INTEGER, LOCATION VARCHAR)
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
Currently Protected Questions, simple search.
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...
SELECT directed_by FROM table_18424435_5 WHERE us_air_date = "July 29, 2011"
Who directed the episode that aired on July 29, 2011?
CREATE TABLE table_18424435_5 (directed_by VARCHAR, us_air_date VARCHAR)
SELECT LOCATION, SUM(number_of_platforms), SUM(total_passengers) FROM station GROUP BY LOCATION
Show all locations and the total number of platforms and passengers for all train stations in each location.
CREATE TABLE station (LOCATION VARCHAR, number_of_platforms INTEGER, total_passengers INTEGER)
SELECT "District" FROM table_64012 WHERE "City Area(km 2 )" < '12' AND "Serial No." = '35'
What district was the city with an area smaller than 12 square kilometers and a serial number of 35?
CREATE TABLE table_64012 ( "Serial No." real, "District" text, "Headquartered City" text, "City Population (2009)" real, "City Area(km 2 )" real )
SELECT COUNT(us_air_date) FROM table_18424435_5 WHERE directed_by = "Jim Donovan"
How many air dates where directed by jim donovan?
CREATE TABLE table_18424435_5 (us_air_date VARCHAR, directed_by VARCHAR)
SELECT DISTINCT LOCATION FROM station WHERE number_of_platforms >= 15 AND total_passengers > 25
Show all locations that have train stations with at least 15 platforms and train stations with more than 25 total passengers.
CREATE TABLE station (LOCATION VARCHAR, number_of_platforms VARCHAR, total_passengers VARCHAR)
SELECT COUNT("Race") FROM table_70335 WHERE "Circuit" = 'mallala motor sport park'
How many races were in the Mallala Motor Sport Park circuit?
CREATE TABLE table_70335 ( "Race" real, "Circuit" text, "Location / State" text, "Date" text, "Winner" text, "Team" text )
SELECT MIN(_number) FROM table_18424435_5
What is the smallest number?
CREATE TABLE table_18424435_5 (_number INTEGER)
SELECT LOCATION FROM station EXCEPT SELECT LOCATION FROM station WHERE number_of_platforms >= 15
Show all locations which don't have a train station with at least 15 platforms.
CREATE TABLE station (LOCATION VARCHAR, number_of_platforms VARCHAR)
SELECT Industry, COUNT(Industry) FROM company GROUP BY Industry
Return a bar chart about the number of companies for each industry.
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...
SELECT us_air_date FROM table_18424435_5 WHERE canadian_viewers__million_ = "1.229"
Which air dates have 1.229 canadian viewers (millions)?
CREATE TABLE table_18424435_5 (us_air_date VARCHAR, canadian_viewers__million_ VARCHAR)
SELECT LOCATION FROM station GROUP BY LOCATION ORDER BY COUNT(*) DESC LIMIT 1
Show the location with most number of train stations.
CREATE TABLE station (LOCATION VARCHAR)
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
The distribution of answerer's reputation over the most recent N answers.
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...
SELECT COUNT(district) FROM table_18425346_2 WHERE serial_no = 9
In what district is the city listed in Serial number 9?
CREATE TABLE table_18425346_2 (district VARCHAR, serial_no VARCHAR)
SELECT name, TIME, service FROM train
Show the name, time, and service for all trains.
CREATE TABLE train (name VARCHAR, TIME VARCHAR, service VARCHAR)
SELECT Rank, COUNT(*) FROM captain GROUP BY Rank ORDER BY Rank DESC
A bar chart about how many captains are in each rank?, and could you order by the X-axis from high to low?
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 )
SELECT COUNT(city_area_km_2__) FROM table_18425346_2 WHERE district = "Sargodha district"
What is the area of the city in the Sargodha district?
CREATE TABLE table_18425346_2 (city_area_km_2__ VARCHAR, district VARCHAR)
SELECT COUNT(*) FROM train
Show the number of trains
CREATE TABLE train (Id VARCHAR)
SELECT "Date" FROM table_47955 WHERE "Label" = 'jugoton'
What is Date, when Label is Jugoton?
CREATE TABLE table_47955 ( "Date" text, "Region" text, "Label" text, "Catalogue" text, "Format" text )
SELECT MIN(city_area_km_2__) FROM table_18425346_2
What is the smallest city area?
CREATE TABLE table_18425346_2 (city_area_km_2__ INTEGER)
SELECT name, service FROM train ORDER BY TIME
Show the name and service for all trains in order by time.
CREATE TABLE train (name VARCHAR, service VARCHAR, TIME VARCHAR)
SELECT "Tie no" FROM table_61081 WHERE "Score" = '2–2' AND "Away team" = 'swansea city'
What is the Tie no when Swansea City is the Away team with a Score of 2 2?
CREATE TABLE table_61081 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text )
SELECT original_air_date FROM table_18427769_1 WHERE directed_by = "Di Drew"
If Di Drew is the director, what was the original air date for episode A Whole Lot to Lose?
CREATE TABLE table_18427769_1 (original_air_date VARCHAR, directed_by VARCHAR)
SELECT T2.name, COUNT(*) FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id
Show the station name and number of trains in each station.
CREATE TABLE station (name VARCHAR, station_id VARCHAR); CREATE TABLE train_station (station_id VARCHAR)
SELECT (SELECT "passengers" FROM table_203_515 WHERE "city" = 'los angeles') - (SELECT "passengers" FROM table_203_515 WHERE "city" = 'saskatoon')
how many more passengers flew to los angeles than to saskatoon from manzanillo airport in 2013 ?
CREATE TABLE table_203_515 ( id number, "rank" number, "city" text, "passengers" number, "ranking" number, "airline" text )
SELECT COUNT(population__2010_census_) FROM table_184334_2 WHERE s_barangay = 51
What is the population (2010 census) if s barangay is 51?
CREATE TABLE table_184334_2 (population__2010_census_ VARCHAR, s_barangay VARCHAR)
SELECT T2.name, T3.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id
show the train name and station name for each train.
CREATE TABLE station (name VARCHAR, station_id VARCHAR); CREATE TABLE train (name VARCHAR, train_id VARCHAR); CREATE TABLE train_station (station_id VARCHAR, train_id VARCHAR)
SELECT MAX(capacity) FROM table_25129482_1
What is the largest capacity for a stadium?
CREATE TABLE table_25129482_1 ( capacity INTEGER )
SELECT MIN(population__2010_census_) FROM table_184334_2 WHERE area___has__ = "66.11"
What is the population (2010 census) if the area is 66.11?
CREATE TABLE table_184334_2 (population__2010_census_ INTEGER, area___has__ VARCHAR)
SELECT T3.name, T3.time FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id WHERE T2.location = 'London' ORDER BY T3.time DESC
Show all train names and times in stations in London in descending order by train time.
CREATE TABLE train_station (station_id VARCHAR, train_id VARCHAR); CREATE TABLE station (station_id VARCHAR, location VARCHAR); CREATE TABLE train (name VARCHAR, time VARCHAR, train_id VARCHAR)
SELECT "Venue" FROM table_4545 WHERE "Away team" = 'geelong'
Where did Geelong play as the away team?
CREATE TABLE table_4545 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
SELECT entered FROM table_18438494_3 WHERE time = "14:42"
How many entered the match with a time of 14:42?
CREATE TABLE table_18438494_3 (entered VARCHAR, time VARCHAR)
SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id ORDER BY COUNT(*) DESC LIMIT 1
Show the station name with greatest number of trains.
CREATE TABLE station (name VARCHAR, station_id VARCHAR); CREATE TABLE train_station (station_id VARCHAR)
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')
list all the takeoffs and landings at MKE
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, ...
SELECT time FROM table_18438494_3 WHERE wrestler = "Cena"
What was the time for the match with Cena?
CREATE TABLE table_18438494_3 (time VARCHAR, wrestler VARCHAR)
SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id HAVING COUNT(*) >= 2
Show the station name with at least two trains.
CREATE TABLE station (name VARCHAR, station_id VARCHAR); CREATE TABLE train_station (station_id VARCHAR)
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...
until 2104 what are the five most common diagnoses that patients are given within the same month after being diagnosed with convulsions nec?
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, ...
SELECT station FROM table_1847523_2 WHERE city_of_license__market = "Cincinnati"
What are all the stations with a license in Cincinnati?
CREATE TABLE table_1847523_2 (station VARCHAR, city_of_license__market VARCHAR)
SELECT LOCATION FROM station GROUP BY LOCATION HAVING COUNT(*) = 1
Show all locations with only 1 station.
CREATE TABLE station (LOCATION VARCHAR)
SELECT "Location Attendance" FROM table_74160 WHERE "Date" = 'April 3'
Where was the game and what was the attendance on April 3?
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 )
SELECT affiliation FROM table_1847523_2 WHERE station = "KMGH-TV"
What station is affiliated with kmgh-tv?
CREATE TABLE table_1847523_2 (affiliation VARCHAR, station VARCHAR)
SELECT name FROM station WHERE NOT station_id IN (SELECT station_id FROM train_station)
Show station names without any trains.
CREATE TABLE station (name VARCHAR, station_id VARCHAR); CREATE TABLE train_station (name VARCHAR, station_id VARCHAR)
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"
tell me the number of patients with lab test item id 50802 who had delta abnormal lab test status.
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, ...
SELECT owned_since FROM table_1847523_2 WHERE station = "WFTS-TV"
How many stations have been owned since wfts-tv?
CREATE TABLE table_1847523_2 (owned_since VARCHAR, station VARCHAR)
SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id WHERE T3.Name = "Ananthapuri Express" INTERSECT SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train...
What are the names of the stations which serve both "Ananthapuri Express" and "Guruvayur Express" trains?
CREATE TABLE station (name VARCHAR, station_id VARCHAR); CREATE TABLE train (train_id VARCHAR, Name VARCHAR); CREATE TABLE train_station (station_id VARCHAR, train_id VARCHAR)
SELECT "Report" FROM table_4653 WHERE "Race Name" = 'champion spark plug 300'
For the race Champion Spark Plug 300, what is the report?
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 )
SELECT city_of_license__market FROM table_1847523_2 WHERE channel___tv___rf__ = "41"
What city of license/market has the channel of 41?
CREATE TABLE table_1847523_2 (city_of_license__market VARCHAR, channel___tv___rf__ VARCHAR)
SELECT T2.name FROM train_station AS T1 JOIN train AS T2 ON T1.train_id = T2.train_id WHERE NOT T1.station_id IN (SELECT T4.station_id FROM train_station AS T3 JOIN station AS T4 ON T3.station_id = T4.station_id WHERE t4.location = "London")
Find the names of the trains that do not pass any station located in London.
CREATE TABLE station (station_id VARCHAR); CREATE TABLE train_station (station_id VARCHAR); CREATE TABLE train_station (train_id VARCHAR, station_id VARCHAR); CREATE TABLE train (name VARCHAR, train_id VARCHAR)
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...
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?
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...
SELECT MIN(owned_since) FROM table_1847523_2 WHERE station = "KERO-TV"
What is the minimum stations owned since kero-tv?
CREATE TABLE table_1847523_2 (owned_since INTEGER, station VARCHAR)
SELECT name, LOCATION FROM station ORDER BY Annual_entry_exit, Annual_interchanges
List the names and locations of all stations ordered by their yearly entry exit and interchange amounts.
CREATE TABLE station (name VARCHAR, LOCATION VARCHAR, Annual_entry_exit VARCHAR, Annual_interchanges VARCHAR)
SELECT "High points" FROM table_21330 WHERE "Score" = '62-70'
If the score is 62-70, what are the high points?
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 )
SELECT lyric_fm__mhz_ FROM table_18475946_2 WHERE rnag__mhz_ = "93.2"
What is the lyric fm for rnag 93.2?
CREATE TABLE table_18475946_2 (lyric_fm__mhz_ VARCHAR, rnag__mhz_ VARCHAR)
SELECT vehicle_id FROM Vehicles
List all vehicle id
CREATE TABLE Vehicles (vehicle_id VARCHAR)
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
Are there Friday classes for SM 470 ?
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...
SELECT 2 AS fm__mhz_ FROM table_18475946_2 WHERE erp__kw_ = "16"
What are the 2fm's for erp 16?
CREATE TABLE table_18475946_2 (erp__kw_ VARCHAR)
SELECT COUNT(*) FROM Vehicles
How many vehicle in total?
CREATE TABLE Vehicles (Id VARCHAR)
SELECT COUNT("Top 10") FROM table_38441 WHERE "Wins" > '0' AND "Poles" > '0'
How many Top 10s have Wins larger than 0, and Poles larger than 0?
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 )
SELECT rnag__mhz_ FROM table_18475946_2 WHERE transmitter = "Kippure"
What is the rnag for kippure transmitter?
CREATE TABLE table_18475946_2 (rnag__mhz_ VARCHAR, transmitter VARCHAR)
SELECT vehicle_details FROM Vehicles WHERE vehicle_id = 1
Show the detail of vehicle with id 1.
CREATE TABLE Vehicles (vehicle_details VARCHAR, vehicle_id VARCHAR)
SELECT "Result" FROM table_8614 WHERE "Week" < '6' AND "Opponent" = 'cleveland browns'
What was the result of the game after week 6 against the cleveland browns?
CREATE TABLE table_8614 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Record" text, "Attendance" text )
SELECT rnag__mhz_ FROM table_18475946_2 WHERE lyric_fm__mhz_ = "98.7"
What is the rnag for lyric fm 98.7?
CREATE TABLE table_18475946_2 (rnag__mhz_ VARCHAR, lyric_fm__mhz_ VARCHAR)
SELECT first_name, middle_name, last_name FROM Staff
List the first name middle name and last name of all staff.
CREATE TABLE Staff (first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR)
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(...
since 1 year ago, patient 029-30149 has undergone a procedure?
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...