table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAno...
Top 100 most economical posts (site-wide).
SELECT Id AS "post_link", LENGTH(Body) AS Length, Score, (Score / CAST(NULLIF(LENGTH(Body), 0) AS FLOAT(9, 2))) AS Economy FROM Posts AS p ORDER BY Economy DESC LIMIT 100
CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text te...
Top Answerers for Tag: score = sum of answer scores/viewCount.
SELECT P.OwnerUserId AS "user_link", SUM(1000 * P.Score / Q.ViewCount) AS TotalScore, SUM(P.Score) AS TotalVotes, SUM(Q.ViewCount) AS TotalViews, COUNT(*) AS "#Answers" FROM Posts AS P INNER JOIN Posts AS Q ON Q.Id = P.ParentId INNER JOIN PostTags AS PT ON PT.PostId = P.ParentId INNER JOIN Tags AS T ON T.Id = PT.TagId ...
CREATE TABLE table_203_663 ( id number, "country" text, "zone" text, "national federation" text, "#gm" number, "#fide" number, "national championship" text )
which country has the most fide rated players after germany ?
SELECT "country" FROM table_203_663 WHERE "country" <> 'germany' ORDER BY "#fide" DESC LIMIT 1
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, ...
what is the number of patients whose ethnicity is black/cape verdean and diagnoses long title is unspecified problem with head, neck, or trunk?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND diagnoses.long_title = "Unspecified problem with head, neck, or trunk"
CREATE TABLE table_20213 ( "#" real, "Season" real, "Bowl game" text, "Result" text, "Opponent" text, "Stadium" text, "Location" text, "Attendance" text )
How many values for attendance correspond to the 1986 Peach Bowl?
SELECT COUNT("Attendance") FROM table_20213 WHERE "Bowl game" = '1986 Peach Bowl'
CREATE TABLE characteristics ( characteristic_id number, characteristic_type_code text, characteristic_data_type text, characteristic_name text, other_characteristic_details text ) CREATE TABLE product_characteristics ( product_id number, characteristic_id number, product_characteristic...
Return the names and typical buying prices for all products.
SELECT product_name, typical_buying_price FROM products
CREATE TABLE table_79797 ( "Tournament" text, "Wins" real, "Top-5" real, "Top-10" real, "Top-25" real, "Events" real, "Cuts made" real )
Name the tournament for top-5 more thn 1 and top-25 of 13 with wins of 3
SELECT "Tournament" FROM table_79797 WHERE "Top-5" > '1' AND "Top-25" = '13' AND "Wins" = '3'
CREATE TABLE table_287 ( "Delegate" text, "Interview" text, "Swimsuit" text, "Evening Gown" text, "Average" text )
Name the interview for peru delegate
SELECT "Interview" FROM table_287 WHERE "Delegate" = 'Peru'
CREATE TABLE customer_addresses ( address_id VARCHAR ) CREATE TABLE addresses ( state_province_county VARCHAR, address_id VARCHAR )
List the state names and the number of customers living in each state.
SELECT t2.state_province_county, COUNT(*) FROM customer_addresses AS t1 JOIN addresses AS t2 ON t1.address_id = t2.address_id GROUP BY t2.state_province_county
CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE aircraft (...
i need a flight from BOSTON to DENVER
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 = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER'...
CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE ...
what were the changes in heart rate in patient 3327 last measured on the first icu visit compared to the value first measured on the first icu visit?
SELECT (SELECT 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 = 3327) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1) AND chartevents.itemi...
CREATE TABLE table_name_34 ( home VARCHAR, date VARCHAR )
Where was the home court on April 14?
SELECT home FROM table_name_34 WHERE date = "april 14"
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardi...
count the amount of patients who were prescribed atovaquone suspension in the same hospital encounter after having been diagnosed with crnry athrscl natve vssl until 2104.
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title =...
CREATE TABLE table_58904 ( "Date" text, "Tournament" text, "Surface" text, "Opponent in Final" text, "Score in Final" text )
What is Opponent in Final, when Date is '13 January 1992'?
SELECT "Opponent in Final" FROM table_58904 WHERE "Date" = '13 january 1992'
CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, ...
i need flights that arrive in BALTIMORE from PITTSBURGH
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 = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BAL...
CREATE TABLE table_name_19 ( tournament VARCHAR, partner VARCHAR )
Which Tournament has a Partner of mart n rodr guez?
SELECT tournament FROM table_name_19 WHERE partner = "martín rodríguez"
CREATE TABLE table_73404 ( "District" text, "Vacator" text, "Reason for change" text, "Successor" text, "Date successor seated" text )
Who is the vacator when south carolina 4th is the district?
SELECT "Vacator" FROM table_73404 WHERE "District" = 'South Carolina 4th'
CREATE TABLE table_69838 ( "Outcome" text, "Date" text, "Surface" text, "Partner" text, "Opponents" text, "Score" text )
What are the dates where the opponent was guillermo garc a-l pez albert portas?
SELECT "Date" FROM table_69838 WHERE "Opponents" = 'guillermo garcía-lópez albert portas'
CREATE TABLE table_68198 ( "Year" real, "English title" text, "Original title" text, "Country" text, "Director'" text )
What country is the film directed by Michael Haneke from?
SELECT "Country" FROM table_68198 WHERE "Director'" = 'michael haneke'
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 the number of patients whose diagnoses long title is acute glomerulonephritis with other specified pathological lesion in kidney and drug route is iv drip?
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.long_title = "Acute glomerulonephritis with other specified pathological lesion in kidney" AND prescripti...
CREATE TABLE table_train_78 ( "id" int, "mini_mental_state_examination_mmse" int, "consent" bool, "swallow_oral_medication" bool, "rosen_modified_hachinski_ischemic_score" int, "NOUSE" float )
unable to swallow uncrushed oral medication in capsule form
SELECT * FROM table_train_78 WHERE swallow_oral_medication = 0
CREATE TABLE table_name_97 ( winner VARCHAR, country VARCHAR, fis_nordic_world_ski_championships VARCHAR )
Which Winner has a Country of norway, and a FIS Nordic World Ski Championships of 1924?
SELECT winner FROM table_name_97 WHERE country = "norway" AND fis_nordic_world_ski_championships = "1924"
CREATE TABLE table_name_81 ( days VARCHAR, _hours VARCHAR, _minutes VARCHAR, dates VARCHAR )
What is the Days, hours, minutes for 21 26 October?
SELECT days, _hours, _minutes FROM table_name_81 WHERE dates = "21 – 26 october"
CREATE TABLE table_50191 ( "Player" text, "Country" text, "Year(s) won" real, "Total" real, "To par" real, "Finish" text )
What is the total number of Year(s) Won, when Player is Ed Furgol, and when To Par is greater than 12?
SELECT COUNT("Year(s) won") FROM table_50191 WHERE "Player" = 'ed furgol' AND "To par" > '12'
CREATE TABLE albums ( id INTEGER, title VARCHAR(160), artist_id INTEGER ) CREATE TABLE customers ( id INTEGER, first_name VARCHAR(40), last_name VARCHAR(20), company VARCHAR(80), address VARCHAR(70), city VARCHAR(40), state VARCHAR(40), country VARCHAR(40), postal_code V...
What are the names of the top 8 countries by total invoice size and what are those sizes. Plot them as bar chart.
SELECT billing_country, SUM(total) FROM invoices GROUP BY billing_country ORDER BY SUM(total) DESC LIMIT 8
CREATE TABLE table_1754531_4 ( domestic_mail VARCHAR, total_freight_and_mail VARCHAR )
Name the total number of domestic mail for 7853 for total frieght and mail
SELECT COUNT(domestic_mail) FROM table_1754531_4 WHERE total_freight_and_mail = 7853
CREATE TABLE table_name_65 ( score VARCHAR, date VARCHAR, competition VARCHAR, brazil_scorers VARCHAR )
Which Score has a Competition of world cup qualifying, and a Brazil scorers of baltazar, and a Date of march 14, 1954?
SELECT score FROM table_name_65 WHERE competition = "world cup qualifying" AND brazil_scorers = "baltazar" AND date = "march 14, 1954"
CREATE TABLE table_24614 ( "Original number" text, "UIC number" text, "Name" text, "Constructer" text, "constructor number" real, "Year" real, "Withdrawn" text, "Kilometers worked" real )
When 2008 t is the original number what is the lowest year?
SELECT MIN("Year") FROM table_24614 WHERE "Original number" = '2008 T'
CREATE TABLE time_slot ( time_slot_id text, day text, start_hr number, start_min number, end_hr number, end_min number ) CREATE TABLE section ( course_id text, sec_id text, semester text, year number, building text, room_number text, time_slot_id text ) CREATE TABLE...
How many total credits are offered by each department?
SELECT SUM(credits), dept_name FROM course GROUP BY dept_name
CREATE TABLE table_23292220_7 ( episode VARCHAR, seans_team VARCHAR )
Name the episode for vic reeves and claudia winkleman
SELECT episode FROM table_23292220_7 WHERE seans_team = "Vic Reeves and Claudia Winkleman"
CREATE TABLE region ( Region_ID int, Region_name text, Date text, Label text, Format text, Catalogue text ) CREATE TABLE member ( Member_ID int, Member_Name text, Party_ID text, In_office text ) CREATE TABLE party ( Party_ID int, Minister text, Took_office text, ...
Plot how many minister by grouped by minister as a bar graph, and list in desc by the y axis.
SELECT Minister, COUNT(Minister) FROM party GROUP BY Minister ORDER BY COUNT(Minister) DESC
CREATE TABLE table_name_76 ( home_team VARCHAR )
How much did the home team st kilda score?
SELECT home_team AS score FROM table_name_76 WHERE home_team = "st kilda"
CREATE TABLE table_name_85 ( rank VARCHAR, goals VARCHAR, matches VARCHAR )
What is the Rank of the player with 158 Goals in more than 362 Matches?
SELECT COUNT(rank) FROM table_name_85 WHERE goals = 158 AND matches > 362
CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) CREATE TABLE flight_s...
what RENTAL CAR are available next sunday from DEN airport
SELECT DISTINCT ground_service.transport_type FROM airport, ground_service WHERE airport.airport_code = 'DEN' AND ground_service.airport_code = airport.airport_code AND ground_service.transport_type = 'RENTAL CAR'
CREATE TABLE table_name_52 ( tournament VARCHAR )
What is the 1944 result for the U.S. Championships?
SELECT 1944 FROM table_name_52 WHERE tournament = "u.s. championships"
CREATE TABLE table_25391981_20 ( viewers__millions_ VARCHAR, episode_number VARCHAR )
How many viewers in millions watched the episode with the number 10.18?
SELECT viewers__millions_ FROM table_25391981_20 WHERE episode_number = "10.18"
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartr...
how many patients received intracranial/cerebral perfusion pressure monitoring - csf drainage via ventriculostomy after the first procedure of the antiemetic - serotonin antagonist in the same month since 1 year ago?
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'antiemetic - serotonin antagonist' AND DATETIME(treatment.treatmenttime) >= DATETIME(CURRENT_TIME(), '-1 yea...
CREATE TABLE table_43995 ( "Rank" text, "Time" text, "Athlete" text, "Nation" text, "Date" text, "Race" text )
What race is on 26 June 2011?
SELECT "Race" FROM table_43995 WHERE "Date" = '26 june 2011'
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 number of patients diagnosed with gangrene were transferred from hosp/extram?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND demographic.diagnosis = "GANGRENE"
CREATE TABLE table_17968229_1 ( home__2nd_leg_ VARCHAR, aggregate VARCHAR )
With an aggregate of 0-2, what is listed for home?
SELECT home__2nd_leg_ FROM table_17968229_1 WHERE aggregate = "0-2"
CREATE TABLE table_10160447_1 ( position VARCHAR, driver VARCHAR )
what's the total number of position with driver robby gordon
SELECT COUNT(position) FROM table_10160447_1 WHERE driver = "Robby Gordon"
CREATE TABLE table_16796 ( "Ward" text, "Bello" text, "Ben-Tahir" text, "Doucet" text, "Furtenbacher" text, "Gauthier" text, "Haydon" text, "Larter" text, "Lawrance" text, "Libweshya" text, "Liscumb" text )
What is Doucet when Lawrance is 36?
SELECT "Doucet" FROM table_16796 WHERE "Lawrance" = '36'
CREATE TABLE Rating ( rID int, mID int, stars int, ratingDate date ) CREATE TABLE Movie ( mID int, title text, year int, director text ) CREATE TABLE Reviewer ( rID int, name text )
Show the title and the lowest rating among all movies in a bar chart.
SELECT title, MIN(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY title
CREATE TABLE table_name_16 ( injured VARCHAR, country VARCHAR )
What was the injured entry for Venezuela?
SELECT injured FROM table_name_16 WHERE country = "venezuela"
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )...
how did patient 028-47306 last visit in this year to the hospital?
SELECT patient.hospitaladmitsource FROM patient WHERE patient.uniquepid = '028-47306' AND DATETIME(patient.hospitaladmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') ORDER BY patient.hospitaladmittime DESC LIMIT 1
CREATE TABLE table_48468 ( "Name" text, "Team" text, "Laps" real, "Time/Retired" text, "Grid" real )
What is Name, when Laps is '50', when Grid is greater than 9, when Team is 'Jim Beam Racing', and when Time/Retired is '+ 18.0s'?
SELECT "Name" FROM table_48468 WHERE "Laps" = '50' AND "Grid" > '9' AND "Team" = 'jim beam racing' AND "Time/Retired" = '+ 18.0s'
CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text...
Select posts with historic use of tag.
SELECT PostId AS "post_link" FROM PostHistory WHERE PostHistoryTypeId IN (3, 6) AND Text LIKE '%<database-schema>%'
CREATE TABLE Rating ( rID int, mID int, stars int, ratingDate date ) CREATE TABLE Reviewer ( rID int, name text ) CREATE TABLE Movie ( mID int, title text, year int, director text )
Ignore movies whose director is NULL. For each director, what are the titles and ratings for all the movies they reviewed? Show the result by a pie chart.
SELECT title, stars FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE director <> "null"
CREATE TABLE table_19343 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Ground" text, "Crowd" text, "Date" text, "Time" text, "Report" text )
What stadiums had an attendance of 8,256?
SELECT "Ground" FROM table_19343 WHERE "Crowd" = '8,256'
CREATE TABLE table_72118 ( "Rd" real, "Name" text, "Pole Position" text, "Fastest Lap" text, "Winning driver" text, "Winning team" text, "Report" text )
The race tony bettenhausen 200 has what smallest rd?
SELECT MIN("Rd") FROM table_72118 WHERE "Name" = 'Tony Bettenhausen 200'
CREATE TABLE table_204_310 ( id number, "month" text, "year" number, "player" text, "county" text, "club" text, "position" number )
how many players won at least later than 2010 ?
SELECT COUNT("player") FROM table_204_310 WHERE "year" > 2010
CREATE TABLE table_50246 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text )
Who was the match against at the PRIDE 31 event?
SELECT "Opponent" FROM table_50246 WHERE "Event" = 'pride 31'
CREATE TABLE table_31084 ( "Rk" real, "Name" text, "Country" text, "Matches Played" real, "Matches Won" real, "Points" real, "Prize Money (USD)" real )
What country offered a prize of 66400 US dollars?
SELECT "Country" FROM table_31084 WHERE "Prize Money (USD)" = '66400'
CREATE TABLE table_29893 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
Who did the high rebounds for the team Minnesota?
SELECT "High rebounds" FROM table_29893 WHERE "Team" = 'Minnesota'
CREATE TABLE table_57094 ( "car plates (since 1937)" text, "Voivodeship Separate city" text, "Capital" text, "Area in 1000km\u00b2 (1930)" text, "Population in 1000 (1931)" text )
between car plates of 80-84 what is the population in 1000 in year 1931?
SELECT "Population in 1000 (1931)" FROM table_57094 WHERE "car plates (since 1937)" = '80-84'
CREATE TABLE table_63827 ( "Year" real, "Competition Description" text, "Location" text, "Apparatus" text, "Rank-Final" real, "Score-Final" real, "Rank-Qualifying" real, "Score-Qualifying" real )
Count the Rank-Final which has a Year larger than 2008, and an Apparatus of balance beam, and a Rank-Qualifying larger than 4?
SELECT COUNT("Rank-Final") FROM table_63827 WHERE "Year" > '2008' AND "Apparatus" = 'balance beam' AND "Rank-Qualifying" > '4'
CREATE TABLE table_29509 ( "Period" text, "Live births per year" text, "Deaths per year" text, "Natural change per year" text, "CBR*" text, "CDR*" text, "NC*" text, "TFR*" text, "IMR*" real, "Life expectancy total" text, "Life expectancy males" text, "Life expectancy fema...
What is the natural change per year for the 34 IMR group?
SELECT "Natural change per year" FROM table_29509 WHERE "IMR*" = '34'
CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city var...
What is class I can take to fulfill the ULCS requirement and is easiest ?
SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_co...
CREATE TABLE table_1342218_35 ( party VARCHAR, district VARCHAR )
What party does the incumbent from the Ohio 20 district belong to?
SELECT party FROM table_1342218_35 WHERE district = "Ohio 20"
CREATE TABLE table_name_57 ( class VARCHAR, weight VARCHAR )
Which Class has a Weight of 203?
SELECT class FROM table_name_57 WHERE weight = 203
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose...
what is the number of patients who have had a nicardipine hcl intake?
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT icustays.hadm_id FROM icustays WHERE icustays.icustay_id IN (SELECT inputevents_cv.icustay_id FROM inputevents_cv WHERE inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'nicardipine hcl' AN...
CREATE TABLE Subjects ( subject_id INTEGER, subject_name VARCHAR(120) ) CREATE TABLE Course_Authors_and_Tutors ( author_id INTEGER, author_tutor_ATB VARCHAR(3), login_name VARCHAR(40), password VARCHAR(40), personal_name VARCHAR(80), middle_name VARCHAR(80), family_name VARCHAR(80),...
List the name and the number of enrolled student for each course. Show bar chart.
SELECT course_name, COUNT(*) FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name
CREATE TABLE table_21355 ( "Date" text, "Opponent" text, "Venue" text, "Result" text, "Attendance" real, "Competition" text, "Man of the Match" text )
How many dates did David Savage get man of the match?
SELECT COUNT("Date") FROM table_21355 WHERE "Man of the Match" = 'David Savage'
CREATE TABLE table_204_500 ( id number, "year" number, "title" text, "peak chart positions\nus country" number, "peak chart positions\nus" number, "album" text )
what was the last single kitty wells released ?
SELECT "title" FROM table_204_500 ORDER BY id DESC LIMIT 1
CREATE TABLE table_name_97 ( super_cup VARCHAR, league VARCHAR, title_playoff VARCHAR, total VARCHAR )
What is the total number of Super Cup, when Title Playoff is '0', when Total is greater than 9, and when League is less than 11?
SELECT COUNT(super_cup) FROM table_name_97 WHERE title_playoff = 0 AND total > 9 AND league < 11
CREATE TABLE table_name_54 ( round INTEGER, opponent VARCHAR )
What is the average number of rounds when fighting against Clay Guida?
SELECT AVG(round) FROM table_name_54 WHERE opponent = "clay guida"
CREATE TABLE photos ( photo_id number, tourist_attraction_id number, name text, description text, filename text, other_details text ) CREATE TABLE ref_attraction_types ( attraction_type_code text, attraction_type_description text ) CREATE TABLE visits ( visit_id number, tourist...
What are the details and star ratings of the three hotels with the lowest price ranges?
SELECT other_hotel_details, star_rating_code FROM hotels ORDER BY price_range LIMIT 3
CREATE TABLE table_47056 ( "Season" text, "Races" real, "Wins" real, "Podiums" real, "Poles" real, "Fastest Laps" real )
What are the total number of podiums for more than 4 laps, and less than 149 races?
SELECT COUNT("Podiums") FROM table_47056 WHERE "Fastest Laps" > '4' AND "Races" < '149'
CREATE TABLE Video_Games ( GameID INTEGER, GName VARCHAR(40), GType VARCHAR(40) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE SportsInfo ( St...
What are the number of the last names for all scholarship students?, list by the how many lname in ascending please.
SELECT LName, COUNT(LName) FROM SportsInfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.OnScholarship = 'Y' GROUP BY LName ORDER BY COUNT(LName)
CREATE TABLE table_69354 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Time" text, "Record" text )
What was the score on August 19?
SELECT "Score" FROM table_69354 WHERE "Date" = 'august 19'
CREATE TABLE table_48625 ( "Team" text, "Head coach" text, "Team captain" text, "Kitmaker" text, "Shirt sponsor" text )
Who is the head coach of the team, whose shirt sponsor is karstadt quelle versicherungen?
SELECT "Head coach" FROM table_48625 WHERE "Shirt sponsor" = 'karstadt quelle versicherungen'
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE treatment ( ...
what are the newly prescribed drugs for patient 022-6959 today compared to that yesterday?
SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '022-6959') AND DATETIME(medication.drugstarttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT medication.drugname FROM medicat...
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, ...
what is the average hospital cost that would involve a vitamin b12 lab test until 4 years ago?
SELECT AVG(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'vitamin b12')) AND DATETIME(cost.chargetime) <= DATETIME(CURRENT_TIME(), '-4 year') GROUP BY cost.had...
CREATE TABLE table_17058116_5 ( location_attendance VARCHAR, game VARCHAR )
In how many locations did Game 13 take place?
SELECT COUNT(location_attendance) FROM table_17058116_5 WHERE game = 13
CREATE TABLE table_name_6 ( region VARCHAR, catalog VARCHAR )
What was the region for the 38xa-5 catalog?
SELECT region FROM table_name_6 WHERE catalog = "38xa-5"
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 prescriptions ( subject_id text, hadm_id...
what is average age of patients whose primary disease is gangrene and admission year is greater than or equal to 2164?
SELECT AVG(demographic.age) FROM demographic WHERE demographic.diagnosis = "GANGRENE" AND demographic.admityear >= "2164"
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...
count the number of patients whose drug name is fluconazole?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "Fluconazole"
CREATE TABLE table_59375 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text )
What is the date of the post-week 2 game with a result of l 16 10?
SELECT "Date" FROM table_59375 WHERE "Week" > '2' AND "Result" = 'l 16–10'
CREATE TABLE Drama_Workshop_Groups ( Workshop_Group_ID INTEGER, Address_ID INTEGER, Currency_Code CHAR(15), Marketing_Region_Code CHAR(15), Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255) ) CREATE TABLE Ref_Payment_Methods ...
List the distinct payment method codes with the number of orders mad in a bar chart, and show by the X in ascending.
SELECT payment_method_code, COUNT(*) FROM Invoices GROUP BY payment_method_code ORDER BY payment_method_code
CREATE TABLE table_train_65 ( "id" int, "intention_to_arterial_catheter" bool, "steroid_therapy" bool, "intention_to_central_venous_catheter" bool, "central_venous_pressure_cvp" int, "receiving_vasopressor" bool, "pulmonary_artery_occlusive_pressure_paop" int, "septic_shock" bool, "a...
an intravenous steroid administered for septic shock, except for those patients who were tested and are responders to a corticotropin stimulation test, or patients who do not receive a steroid due to the clinical judgment of the treating physician, based on an alternate assessment ( e.g. normal baseline cortisol ) .
SELECT * FROM table_train_65 WHERE steroid_therapy = 1 AND septic_shock = 1
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, ...
what is first weight of patient 12410 in 08/2101.
SELECT 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 = 12410)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit wt'...
CREATE TABLE table_204_779 ( id number, "network name" text, "flagship" text, "programming type" text, "owner" text, "affiliates" number )
azteca 7 and azteca 13 are both owned by whom ?
SELECT "owner" FROM table_204_779 WHERE "network name" = 'azteca 7'
CREATE TABLE Ref_Attraction_Types ( Attraction_Type_Code CHAR(15), Attraction_Type_Description VARCHAR(255) ) CREATE TABLE Photos ( Photo_ID INTEGER, Tourist_Attraction_ID INTEGER, Name VARCHAR(255), Description VARCHAR(255), Filename VARCHAR(255), Other_Details VARCHAR(255) ) CREATE T...
What are the distinct visit dates, and count them by a line chart, and I want to order x axis in desc order.
SELECT Visit_Date, COUNT(Visit_Date) FROM Visits ORDER BY Visit_Date DESC
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREAT...
when were patient 010-1155 first prescribed for warfarin sodium 5 mg po tabs and potassium chloride at the same time in this month?
SELECT t1.drugstarttime FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'warfarin sodium 5 mg po tabs' AND patient.uniquepid = '010-1155' AND DATETIME(medication.drugstarttime, 'start of month')...
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code tex...
what is the one year survival rate of a person with hypomagnesemia - due to etoh abuse?
SELECT SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t2.diagnosistime) > 1 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOI...
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE vitalperiodi...
how many days have passed since patient 027-203413 had a nutrition total intake for the last time on the current intensive care unit visit?
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', intakeoutput.intakeoutputtime)) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid =...
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugst...
when was last time patient 028-22327 was diagnosed since 4 years ago with cardiomyopathy?
SELECT diagnosis.diagnosistime FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '028-22327')) AND diagnosis.diagnosisname = 'cardiomyopathy' AND D...
CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numciting int, numcitedby int, journalid int ) CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE field ( fieldid int...
Semantic Parsing papers by Li Dong
SELECT DISTINCT author.authorid, paper.paperid FROM author, keyphrase, paper, paperkeyphrase, writes WHERE author.authorname = 'Li Dong' AND keyphrase.keyphrasename = 'Semantic Parsing' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid AND writes.authorid = author.authori...
CREATE TABLE table_name_44 ( frame_size VARCHAR, color_sampling VARCHAR, audio_coding VARCHAR, format_name VARCHAR )
What frame size has pcm 4 ch/16 bit/48khz as audio coding and dvcam as the format name and 4:1:1 as the color sampling?
SELECT frame_size FROM table_name_44 WHERE audio_coding = "pcm 4 ch/16 bit/48khz" AND format_name = "dvcam" AND color_sampling = "4:1:1"
CREATE TABLE table_name_1 ( year INTEGER, bronze VARCHAR )
What is listed as the highest Year that's also got a Bronze of Wataru Haraguchi?
SELECT MAX(year) FROM table_name_1 WHERE bronze = "wataru haraguchi"
CREATE TABLE table_200_35 ( id number, "party" text, "active voters" number, "inactive voters" number, "total voters" number, "percentage" text )
as of october 25 , 2005 , how many active voters are there ?
SELECT SUM("active voters") FROM table_200_35
CREATE TABLE table_80134 ( "Year" text, "Men's singles" text, "Women's singles" text, "Men's doubles" text, "Women's doubles" text, "Mixed doubles" text )
Who won the Men's Double the same year as Florentina Petre winning the Women's Singles?
SELECT "Men's doubles" FROM table_80134 WHERE "Women's singles" = 'florentina petre'
CREATE TABLE table_name_48 ( points INTEGER, fgm___fga VARCHAR, number VARCHAR )
What is the point average for the game that has FGM-FGA of 11-28 and a number smaller than 7?
SELECT AVG(points) FROM table_name_48 WHERE fgm___fga = "11-28" AND number < 7
CREATE TABLE table_name_59 ( attendance VARCHAR, week VARCHAR )
What was the Attendance in Week 10?
SELECT attendance FROM table_name_59 WHERE week = 10
CREATE TABLE table_32666 ( "Player" text, "Nationality" text, "Position" text, "From" real, "School/Country" text )
What position is the player from 1987?
SELECT "Position" FROM table_32666 WHERE "From" = '1987'
CREATE TABLE table_name_15 ( average INTEGER, number_of_dances VARCHAR, total VARCHAR )
What is the highest average that has 6 dances and a total of over 128?
SELECT MAX(average) FROM table_name_15 WHERE number_of_dances = 6 AND total > 128
CREATE TABLE table_74756 ( "Region" text, "Date" text, "Label" text, "Format" text, "Catalog" text )
What label is associated with the United Kingdom and the chem036 catalog?
SELECT "Label" FROM table_74756 WHERE "Region" = 'united kingdom' AND "Catalog" = 'chem036'
CREATE TABLE table_63482 ( "Year" real, "Title" text, "Director" text, "Studio(s)" text, "Notes" text )
What studio has the director Philip Frank Messina?
SELECT "Studio(s)" FROM table_63482 WHERE "Director" = 'philip frank messina'
CREATE TABLE table_2308381_1 ( year VARCHAR, avg_start VARCHAR )
Name the year for avg start being 22.4
SELECT year FROM table_2308381_1 WHERE avg_start = "22.4"
CREATE TABLE table_name_33 ( location_attendance VARCHAR, team VARCHAR )
What were the location and attendance for the game against New Jersey?
SELECT location_attendance FROM table_name_33 WHERE team = "new jersey"