table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
⌀
CREATE TABLE table_name_86 ( Id VARCHAR )
Where were the 2009 and 2011 Grand Slam Tournaments?
SELECT 2011 FROM table_name_86 WHERE 2009 = "grand slam tournaments"
CREATE TABLE table_name_25 ( rank VARCHAR, bronze VARCHAR, silver VARCHAR, gold VARCHAR )
Which rank has more than 1 silver, more than 1 gold, and more than 4 bronze?
SELECT rank FROM table_name_25 WHERE silver > 1 AND gold > 1 AND bronze > 4
CREATE TABLE table_20164 ( "No. in series" text, "No. in season" text, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "U.S. viewers (million)" text )
Name who directed the 114 episode in the series
SELECT "Directed by" FROM table_20164 WHERE "No. in series" = '114'
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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
what is the number of patients whose gender is f and diagnoses icd9 code is 42831?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "F" AND diagnoses.icd9_code = "42831"
CREATE TABLE table_name_25 ( website VARCHAR, last_release VARCHAR )
What is Website, when Last Release is 2009-08-09, 1.2.9?
SELECT website FROM table_name_25 WHERE last_release = "2009-08-09, 1.2.9"
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 procedures ( ...
provide the number of patients whose death status is 0 and diagnoses icd9 code is 42833?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "0" AND diagnoses.icd9_code = "42833"
CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE days ( days_code varchar, day_name varchar ) CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE fligh...
find the earliest BREAKFAST flight from BOSTON 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, food_service WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'OAKLAND' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code AND food_s...
CREATE TABLE screen_mode ( graphics_mode number, char_cells text, pixels text, hardware_colours number, used_kb number, map text, type text ) CREATE TABLE phone ( company_name text, hardware_model_name text, accreditation_type text, accreditation_level text, date text, ...
List all the model names sorted by their launch year.
SELECT model_name FROM chip_model ORDER BY launch_year
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, ...
what diagnosis did patient 32153 receive on the current hospital encounter for the first time?
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT diagnoses_icd.icd9_code FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 32153 AND admissions.dischtime IS NULL) ORDER BY diagnoses_icd.charttime L...
CREATE TABLE STUDENT ( STU_NUM int, STU_LNAME varchar(15), STU_FNAME varchar(15), STU_INIT varchar(1), STU_DOB datetime, STU_HRS int, STU_CLASS varchar(2), STU_GPA float(8), STU_TRANSFER numeric, DEPT_CODE varchar(18), STU_PHONE varchar(4), PROF_NUM int ) CREATE TABLE EN...
Return a pie on how many departments are in each school?
SELECT SCHOOL_CODE, COUNT(DISTINCT DEPT_NAME) FROM DEPARTMENT
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...
had the morphine inj, sodium chloride 0.9% 1,000 ml bag or potassium chloride crys er 20 meq po tbcr been prescribed for patient 009-15 in 2104?
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 = '009-15')) AND medication.drugname IN ('morphine inj', 'sodium chloride 0.9...
CREATE TABLE table_3245 ( "Round" real, "Circuit" text, "Date" text, "Pole Position" text, "Fastest Lap" text, "Winning Driver" text, "Winning Team" text )
How many Pole Positions were there on 30 March?
SELECT COUNT("Pole Position") FROM table_3245 WHERE "Date" = '30 March'
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 much patient 027-154299 weighs in 12/this year for the last time.
SELECT patient.admissionweight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-154299') AND NOT patient.admissionweight IS NULL AND DATETIME(patient.unitadmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '...
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto 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 ) CREATE TABLE cos...
what is the four most frequently given diagnoses since 2105 for patients who have previously been diagnosed with ac diastolic hrt failure within 2 months?
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions...
CREATE TABLE table_203_300 ( id number, "year" number, "tournament" text, "venue" text, "result" text, "extra" text )
which year held the most tournaments ?
SELECT "year" FROM table_203_300 GROUP BY "year" ORDER BY COUNT("tournament") DESC LIMIT 1
CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, ...
Four major RDBMS systems, ranked by popularity.
SELECT TagName AS Tags, cnt AS "questions_tagged", ROUND(100.0 * cnt / SUM(cnt) OVER (), 2) AS "ratio,_%" FROM Tags AS t JOIN LATERAL (SELECT COUNT(*) AS cnt FROM PostTags AS pt WHERE pt.TagId = t.Id) AS q WHERE t.TagName IN ('adminer', 'phpmyadmin', 'navicat', 'sqlyog', 'sqlbuddy', 'toad', 'dbninja', 'sqlwave', 'chive...
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER )
For those records from the products and each product's manufacturer, visualize a bar chart about the distribution of founder and the sum of price , and group by attribute founder, and display total number from low to high order.
SELECT Founder, SUM(Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder ORDER BY SUM(Price)
CREATE TABLE table_29762 ( "Stadium" text, "City" text, "Capacity" real, "Matches played" real, "Overall attendance" real, "Average attendance per match" real, "Average attendance as % of Capacity" text, "Overall goals scored" real, "Average goals scored per match" text, "Elevati...
how many matches were played that average goals scored 1.25?
SELECT COUNT("Matches played") FROM table_29762 WHERE "Average goals scored per match" = '1.25'
CREATE TABLE table_name_43 ( result VARCHAR, attendance VARCHAR )
What is the result of the game when the attendance is 75,466?
SELECT result FROM table_name_43 WHERE attendance = "75,466"
CREATE TABLE table_name_12 ( class VARCHAR, erp_w VARCHAR )
What is the class for the ERP W of 500?
SELECT class FROM table_name_12 WHERE erp_w = 500
CREATE TABLE table_27842 ( "Institution" text, "Location" text, "Type" text, "Joined" real, "Enrollment" real, "Nickname" text )
What type of institution is San Diego Christian college?
SELECT "Type" FROM table_27842 WHERE "Institution" = 'San Diego Christian College'
CREATE TABLE table_48545 ( "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 2010 wta premier 5 tournaments?
SELECT "2007" FROM table_48545 WHERE "2010" = 'wta premier 5 tournaments'
CREATE TABLE table_name_10 ( ties INTEGER, losses VARCHAR, games_played VARCHAR )
what is the lowest number of ties when the losses is 7 and games played is less than 10?
SELECT MIN(ties) FROM table_name_10 WHERE losses = 7 AND games_played < 10
CREATE TABLE table_26948 ( "Name" text, "Position" text, "Period" text, "Appearances\u00b9" real, "Goals\u00b9" real, "Nationality\u00b2" text )
What country is Pierre Vermeulen from?
SELECT "Nationality\u00b2" FROM table_26948 WHERE "Name" = 'Pierre Vermeulen'
CREATE TABLE table_65597 ( "Rank" real, "Lane" real, "Name" text, "Nationality" text, "Time" text )
Which nationality has rank 4?
SELECT "Nationality" FROM table_65597 WHERE "Rank" = '4'
CREATE TABLE table_40630 ( "City" text, "Jan." text, "Feb." text, "Mar." text, "Apr." text, "May." text, "Jun." text, "Jul." text, "Aug." text, "Sep." text, "Oct." text, "Nov." text, "Dec." text )
What were the Feb temperatures in East Stroudsburg?
SELECT "Feb." FROM table_40630 WHERE "City" = 'east stroudsburg'
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0...
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, give me the comparison about the sum of employee_id over the job_id , and group by attribute job_id, and could you show in desc by the names?
SELECT JOB_ID, SUM(EMPLOYEE_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID ORDER BY JOB_ID DESC
CREATE TABLE table_26494 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real, "U.S. viewers (millions)" text )
what number is us viewers in season 12?
SELECT "U.S. viewers (millions)" FROM table_26494 WHERE "No. in season" = '12'
CREATE TABLE table_name_18 ( type VARCHAR, group VARCHAR )
What is the type of station that is in the movies group?
SELECT type FROM table_name_18 WHERE group = "movies"
CREATE TABLE table_38120 ( "Year" real, "Location" text, "Gold" text, "Silver" text, "Bronze" text )
What is the most recent year that China won a bronze?
SELECT MAX("Year") FROM table_38120 WHERE "Bronze" = 'china'
CREATE TABLE table_name_23 ( episode__number VARCHAR, original_airdate VARCHAR )
What is the episode # of the episode that aired on April 5, 1998?
SELECT episode__number FROM table_name_23 WHERE original_airdate = "april 5, 1998"
CREATE TABLE Subjects ( subject_id INTEGER, subject_name VARCHAR(120) ) CREATE TABLE Courses ( course_id INTEGER, author_id INTEGER, subject_id INTEGER, course_name VARCHAR(120), course_description VARCHAR(255) ) CREATE TABLE Students ( student_id INTEGER, date_of_registration DATE...
A bar chart for finding the number of the dates of the tests taken with result 'Pass', I want to show by the y-axis in ascending.
SELECT date_test_taken, COUNT(date_test_taken) FROM Student_Tests_Taken WHERE test_result = "Pass" GROUP BY date_test_taken ORDER BY COUNT(date_test_taken)
CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversa...
Average score for a tag. Returns the average score for a tag. Not sure about the accuracy, but it satisfied my curiosity enough.
SELECT CAST(SUM(Score) AS FLOAT) / CAST(COUNT(Score) AS FLOAT) AS AvgScore FROM Posts
CREATE TABLE table_name_89 ( country VARCHAR, player VARCHAR )
What country is player mike sullivan from?
SELECT country FROM table_name_89 WHERE player = "mike sullivan"
CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE field ( fieldid int ) CREATE TABLE dataset ( datasetid int, datasetname varchar ) CREATE T...
number of ACL papers by author
SELECT DISTINCT COUNT(paper.paperid), writes.authorid FROM paper, venue, writes WHERE venue.venueid = paper.venueid AND venue.venuename = 'ACL' AND writes.paperid = paper.paperid GROUP BY writes.authorid
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id...
For patients born after the year 2060, calculate the maximum duration of stay in the hospital
SELECT MAX(demographic.days_stay) FROM demographic WHERE demographic.dob_year > "2060"
CREATE TABLE table_23250 ( "Rank" real, "Couple" text, "Judges" real, "Public" real, "Total" real, "Vote percentage" text, "Result" text )
When 8 is the public and the result is safe what is the highest rank?
SELECT MAX("Rank") FROM table_23250 WHERE "Result" = 'Safe' AND "Public" = '8'
CREATE TABLE table_36991 ( "Distance" text, "Event" text, "Record" text, "Nationality" text, "Year" real, "Location" text )
What was the distance in 1997?
SELECT "Distance" FROM table_36991 WHERE "Year" = '1997'
CREATE TABLE table_29521180_35 ( round_of_16 VARCHAR, athlete VARCHAR )
What was the round of 16 result for felipe saucedo?
SELECT round_of_16 FROM table_29521180_35 WHERE athlete = "Felipe Saucedo"
CREATE TABLE table_69428 ( "7:00" text, "7:30" text, "8:00" text, "8:30" text, "9:00" text, "9:30" text, "10:00" text )
What is the 10:00 feature with 1 vs. 100 at 8:30?
SELECT "10:00" FROM table_69428 WHERE "8:30" = '1 vs. 100'
CREATE TABLE table_1061075_1 ( competition VARCHAR, aggregate VARCHAR )
what's the competition where aggregate is 4 7
SELECT competition FROM table_1061075_1 WHERE aggregate = "4–7"
CREATE TABLE table_name_24 ( lane INTEGER, overall_rank VARCHAR, time VARCHAR )
What is the greatest lane with an overall rank of 79 and a time larger than 26.1?
SELECT MAX(lane) FROM table_name_24 WHERE overall_rank = "79" AND time > 26.1
CREATE TABLE table_44881 ( "Hanyu" text, "Tongyong" text, "Pe\u030dh-\u014de-j\u012b" text, "Chinese" text, "Area (km\u00b2)" real, "No. of villages" real, "Population (2010)" real )
Where in Tongyong is Hanyu Sanmin?
SELECT "Tongyong" FROM table_44881 WHERE "Hanyu" = 'sanmin'
CREATE TABLE table_2624098_1 ( english_day_name_meaning VARCHAR, old_english_day_name VARCHAR )
what is the English meaning of the old English name 's turnesd g'?
SELECT english_day_name_meaning FROM table_2624098_1 WHERE old_english_day_name = "Sæturnesdæg"
CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate ti...
my answers not tagged <excel> THAT SHOULD BE.
SELECT a.ParentId AS "post_link", q.Tags, a.Score FROM Posts AS q LEFT OUTER JOIN Posts AS a ON q.Id = a.ParentId WHERE a.OwnerUserId = '##UserID##' AND q.Tags LIKE '%excel%' AND NOT q.Tags LIKE '%<excel>%' ORDER BY a.Score DESC
CREATE TABLE table_53479 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real )
Which Week has an Opponent of san francisco 49ers?
SELECT MAX("Week") FROM table_53479 WHERE "Opponent" = 'san francisco 49ers'
CREATE TABLE table_3653 ( "Pick #" real, "Player" text, "Position" text, "Nationality" text, "NHL team" text, "College/junior/club team" text )
What is the college/junior/club team for player don barber?
SELECT "College/junior/club team" FROM table_3653 WHERE "Player" = 'Don Barber'
CREATE TABLE table_33256 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What was the size of the crowd that saw the Home team score 11.10 (76)?
SELECT COUNT("Crowd") FROM table_33256 WHERE "Home team score" = '11.10 (76)'
CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numciting int, numcitedby int, journalid int ) CREATE TABLE paperfield ( fieldid...
Papers by Frank Keller and Mirella Lapata
SELECT DISTINCT WRITES_0.paperid FROM author AS AUTHOR_0, author AS AUTHOR_1, writes AS WRITES_0, writes AS WRITES_1 WHERE AUTHOR_0.authorname = 'Frank Keller' AND AUTHOR_1.authorname = 'Mirella Lapata' AND WRITES_0.authorid = AUTHOR_0.authorid AND WRITES_1.authorid = AUTHOR_1.authorid AND WRITES_1.paperid = WRITES_0.p...
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val...
what was the average sao2 on 01/06/last year for patient 3242.
SELECT AVG(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 = 3242)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'sao2'...
CREATE TABLE table_20584 ( "No." real, "Date" text, "Tournament" text, "Winning score" text, "To par" text, "Margin of victory" text, "Runner(s)-up" text )
Who was the runner up at the Volvo Masters Andalucia?
SELECT "Runner(s)-up" FROM table_20584 WHERE "Tournament" = 'Volvo Masters Andalucia'
CREATE TABLE table_name_20 ( airport VARCHAR )
Which 2008 has an Airport of hurghada international airport?
SELECT AVG(2008) FROM table_name_20 WHERE airport = "hurghada international airport"
CREATE TABLE table_56380 ( "Bowling figures Wickets-Runs (Overs)" text, "Bowler" text, "Versus" text, "Venue" text, "Date" text )
What were the bowling figures for the competition at Pietermaritzburg?
SELECT "Bowling figures Wickets-Runs (Overs)" FROM table_56380 WHERE "Venue" = 'pietermaritzburg'
CREATE TABLE table_46962 ( "Name" text, "Premier League" real, "League Cup" real, "FA Cup" real, "Total" real )
What is the average total of kenwyne jones, who has more than 10 premier leagues?
SELECT AVG("Total") FROM table_46962 WHERE "Name" = 'kenwyne jones' AND "Premier League" > '10'
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's the average cost of a hospital that includes a drug called albuterol-ipratropium (duoneb) inhalation solution 3 ml in 2104?
SELECT AVG(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'albuterol-ipratropium (duoneb) inhalation solu...
CREATE TABLE entrepreneur ( Entrepreneur_ID int, People_ID int, Company text, Money_Requested real, Investor text ) CREATE TABLE people ( People_ID int, Name text, Height real, Weight real, Date_of_Birth text )
Display a bar chart for what are the investors of entrepreneurs and the corresponding number of entrepreneurs invested by each investor?, and show in desc by the total number please.
SELECT Investor, COUNT(*) FROM entrepreneur GROUP BY Investor ORDER BY COUNT(*) DESC
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ...
what is the primary disease and diagnosis of the patient id 8440?
SELECT demographic.diagnosis, diagnoses.short_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "8440"
CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_stay int, application text, no_discounts text ) CREATE TA...
show me the flights from SAN FRANCISCO to PITTSBURGH on tuesday
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, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBURGH' AND date_day.day_number = 22 AND date_day.month_number = 3 AN...
CREATE TABLE table_21892 ( "Outcome" text, "Year" real, "Championship" text, "Surface" text, "Partner" text, "Opponents" text, "Score" text )
On what surface was the game played with a score of 6 4, 6 4?
SELECT "Surface" FROM table_21892 WHERE "Score" = '6–4, 6–4'
CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE field ( fieldid int ) CREATE TABLE dataset ( datasetid int, datasetname varchar ) CREATE T...
papers before 2010 about character recognition
SELECT DISTINCT paper.paperid FROM keyphrase, paper, paperkeyphrase WHERE keyphrase.keyphrasename = 'character recognition' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid AND paper.year < 2010
CREATE TABLE table_51118 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
Which country has a score of 70-71-72=213?
SELECT "Country" FROM table_51118 WHERE "Score" = '70-71-72=213'
CREATE TABLE table_name_30 ( sales_total VARCHAR, chart VARCHAR )
Which Sales Total has a Chart of oricon monthly albums chart?
SELECT sales_total FROM table_name_30 WHERE chart = "oricon monthly albums chart"
CREATE TABLE table_name_69 ( nationality VARCHAR, school_club_team VARCHAR )
What Nationality is the Iowa State team?
SELECT nationality FROM table_name_69 WHERE school_club_team = "iowa state"
CREATE TABLE table_name_31 ( year VARCHAR, result VARCHAR )
In which year did he finish 11th?
SELECT COUNT(year) FROM table_name_31 WHERE result = "11th"
CREATE TABLE table_2592 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text )
What' the series number of the episode with season number 13?
SELECT MIN("No. in series") FROM table_2592 WHERE "No. in season" = '13'
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...
give me the number of patients whose diagnoses short title is history of tobacco use and lab test category is blood gas?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "History of tobacco use" AND lab."CATEGORY" = "Blood Gas"
CREATE TABLE table_12357 ( "Model" text, "Chassis code" text, "Production time" text, "Number built" real, "Engine" text )
What's the production time with more than 2.737 built and a 280s model?
SELECT "Production time" FROM table_12357 WHERE "Number built" > '2.737' AND "Model" = '280s'
CREATE TABLE table_name_80 ( total INTEGER, county VARCHAR )
What is galway county's total?
SELECT SUM(total) FROM table_name_80 WHERE county = "galway"
CREATE TABLE Manufacturers ( name VARCHAR, code VARCHAR ) CREATE TABLE products ( Price INTEGER, manufacturer VARCHAR, price INTEGER )
Select the names of manufacturer whose products have an average price higher than or equal to $150.
SELECT AVG(T1.price), T2.name FROM products AS T1 JOIN Manufacturers AS T2 ON T1.manufacturer = T2.code GROUP BY T2.name HAVING AVG(T1.price) >= 150
CREATE TABLE table_203_853 ( id number, "date" text, "opponent" text, "home/away" text, "field" text, "result" text )
what was the difference in score between the barrage and the lizards on june 2 .
SELECT ABS("result" - "result") FROM table_203_853 WHERE "date" = 'june 2'
CREATE TABLE room ( roomnumber number, roomtype text, blockfloor number, blockcode number, unavailable boolean ) CREATE TABLE trained_in ( physician number, treatment number, certificationdate time, certificationexpires time ) CREATE TABLE block ( blockfloor number, blockco...
Find the ids of the nurses who are on call in block floor 1 and block code 1.
SELECT nurse FROM on_call WHERE blockfloor = 1 AND blockcode = 1
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE intakeoutput ( intakeoutpu...
when was patient 002-30780 prescribed a drug for the first time on the last hospital encounter?
SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-30780' AND NOT patient.hospitaldischargetime IS NULL ORDER...
CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE flight ( aircraft_code_sequence text, air...
what is the latest flight on wednesday going from ATLANTA to WASHINGTON
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, date_day, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WASHINGTON' AND date_day.day_number = 23 AND date_day.month_number = 4 A...
CREATE TABLE table_658 ( "Department" text, "Acronym" text, "Office" text, "Incumbent" text, "in Office since" text )
what's the acronym with department being department of finance kagawaran ng pananalapi
SELECT "Acronym" FROM table_658 WHERE "Department" = 'Department of Finance Kagawaran ng Pananalapi'
CREATE TABLE event ( Event_ID int, Date text, Venue text, Name text, Event_Attendance int ) CREATE TABLE journalist ( journalist_ID int, Name text, Nationality text, Age text, Years_working int ) CREATE TABLE news_report ( journalist_ID int, Event_ID int, Work_Type ...
Visualize the average experience working length of journalists working on different role type using a pie chart.
SELECT Work_Type, AVG(Years_working) FROM journalist AS t1 JOIN news_report AS t2 ON t1.journalist_ID = t2.journalist_ID GROUP BY t2.Work_Type
CREATE TABLE table_name_23 ( semifinalists VARCHAR, finalist VARCHAR )
Which Semifinalists has a Finalist of andre agassi?
SELECT semifinalists FROM table_name_23 WHERE finalist = "andre agassi"
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( ...
What is the date of birth and language of Kurt Buczek?
SELECT demographic.dob, demographic.language FROM demographic WHERE demographic.name = "Kurt Buczek"
CREATE TABLE table_name_16 ( name VARCHAR, rank VARCHAR, last VARCHAR )
Who had a rank more than 48, and a last in 2005?
SELECT name FROM table_name_16 WHERE rank > 48 AND last = 2005
CREATE TABLE table_22669044_9 ( high_points VARCHAR, record VARCHAR )
Name the high points 31-27
SELECT high_points FROM table_22669044_9 WHERE record = "31-27"
CREATE TABLE table_76691 ( "Date" text, "Time" text, "Opponent" text, "Score" text, "Site" text, "City" text )
Which Score has a Time of 5:00pm?
SELECT "Score" FROM table_76691 WHERE "Time" = '5:00pm'
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...
How many distinct characteristic names does the product 'cumin' have?
SELECT COUNT(DISTINCT t3.characteristic_name) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN characteristics AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "sesame"
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 procedures ( ...
what is procedure icd9 code and procedure long title of subject id 813?
SELECT procedures.icd9_code, procedures.long_title FROM procedures WHERE procedures.subject_id = "813"
CREATE TABLE table_40751 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
Which Bronze has a Rank of 9?
SELECT COUNT("Bronze") FROM table_40751 WHERE "Rank" = '9'
CREATE TABLE table_name_95 ( year VARCHAR, result VARCHAR, extra VARCHAR, tournament VARCHAR )
In which year was the Tournament of european indoor championships played where the Extra was 800 m and the Result was 2nd?
SELECT year FROM table_name_95 WHERE extra = "800 m" AND tournament = "european indoor championships" AND result = "2nd"
CREATE TABLE table_name_63 ( driver VARCHAR, grid VARCHAR )
Which driver had a grid of 2?
SELECT driver FROM table_name_63 WHERE grid = 2
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...
Suggested edits with review time.
SELECT pt.Name, p.Id AS "post_link", 'site://suggested-edits/' + CAST(se.Id AS TEXT) AS "Suggested edit", ROUND(CAST((JULIANDAY(COALESCE(ApprovalDate, RejectionDate)) - JULIANDAY(se.CreationDate)) * 86400.0 AS INT) / 86400., 2) AS "Review time (days)" FROM SuggestedEdits AS se INNER JOIN Posts AS p ON se.PostId = p.Id ...
CREATE TABLE table_40917 ( "Title" text, "Director" text, "Producer" text, "Production Cost" text, "Singapore Gross" text )
Who was the producer for the film directed by 1997?
SELECT "Producer" FROM table_40917 WHERE "Director" = '1997'
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
provide the number of patients who have angioedema primary disease.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "ANGIOEDEMA"
CREATE TABLE table_63490 ( "Rank" real, "Peak" text, "Country" text, "Island" text, "Elevation (m)" real, "Col (m)" real )
What is the rank when the elevation is 1,628, and Col (m) is larger than 0?
SELECT COUNT("Rank") FROM table_63490 WHERE "Elevation (m)" = '1,628' AND "Col (m)" > '0'
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...
Number of questions by country.
SELECT COUNT(*) FROM Posts WHERE OwnerUserId IN (SELECT Id FROM Users WHERE NOT Location IS NULL)
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 demographic ( subject_id text, hadm_id t...
Provide the number of patients who had other closed [endoscopic] biopsy of biliary duct or sphincter of oddi and were born before 2060.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dob_year < "2060" AND procedures.long_title = "Other closed [endoscopic] biopsy of biliary duct or sphincter of Oddi"
CREATE TABLE table_22409 ( "Episode" text, "Garfield Episode 1" text, "U.S. Acres Episode" text, "Garfield Episode 2" text, "Original Airdate" text )
What is the name of episode 2 for garfield when episode 1 is 'suburban jungle'?
SELECT "Garfield Episode 2" FROM table_22409 WHERE "Garfield Episode 1" = 'Suburban Jungle'
CREATE TABLE table_name_40 ( cargo VARCHAR, ship_size VARCHAR )
What cargo was contained in a ship size of aframax?
SELECT cargo FROM table_name_40 WHERE ship_size = "aframax"
CREATE TABLE Patient ( SSN INTEGER, Name VARCHAR(30), Address VARCHAR(30), Phone VARCHAR(30), InsuranceID INTEGER, PCP INTEGER ) CREATE TABLE Block ( BlockFloor INTEGER, BlockCode INTEGER ) CREATE TABLE Medication ( Code INTEGER, Name VARCHAR(30), Brand VARCHAR(30), Des...
Return the name of each physician and the number of patients he or she treats by a pie chart.
SELECT T1.Name, COUNT(*) FROM Physician AS T1 JOIN Patient AS T2 ON T1.EmployeeID = T2.PCP GROUP BY T1.EmployeeID
CREATE TABLE table_54784 ( "Round" real, "Pick" real, "Player" text, "Position" text, "Nationality" text, "Team" text, "College" text )
Name the team for pick more than 30 and position of c with round more than 4
SELECT "Team" FROM table_54784 WHERE "Pick" > '30' AND "Position" = 'c' AND "Round" > '4'
CREATE TABLE table_name_18 ( frequency VARCHAR, on_air_id VARCHAR )
Name the frequency with on-air ID of 1way fm
SELECT frequency FROM table_name_18 WHERE on_air_id = "1way fm"
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id...
count the number of patients whose admission year is less than 2167 and lab test name is reticulocyte count, automated?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2167" AND lab.label = "Reticulocyte Count, Automated"
CREATE TABLE table_30064 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text, "U.S. viewers (million)" text )
What is the name of the episode that had 2.02 million u.s. viewers?
SELECT "Title" FROM table_30064 WHERE "U.S. viewers (million)" = '2.02'
CREATE TABLE table_1065 ( "Pos" real, "Member Association" text, "Points (total 500)" real, "Clubs" real, "Group stage" real, "Play-off" real, "AFC Cup" real )
How many times has the points total for the afc cup competion been 289?
SELECT COUNT("AFC Cup") FROM table_1065 WHERE "Points (total 500)" = '289'
CREATE TABLE order_items ( order_id VARCHAR, product_id VARCHAR ) CREATE TABLE customers ( customer_name VARCHAR, customer_id VARCHAR ) CREATE TABLE customer_orders ( customer_id VARCHAR, order_id VARCHAR ) CREATE TABLE products ( product_id VARCHAR, product_name VARCHAR )
List the names of all the distinct customers who bought a keyboard.
SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T2.order_id = T3.order_id JOIN products AS T4 ON T3.product_id = T4.product_id WHERE T4.product_name = "keyboard"