table stringlengths 33 7.14k | question stringlengths 4 1.06k | output stringlengths 2 4.44k ⌀ |
|---|---|---|
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
... | what is admission time and diagnoses long title of subject id 2560? | SELECT demographic.admittime, diagnoses.long_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "2560" |
CREATE TABLE table_56425 (
"Date" text,
"Tournament" text,
"Surface" text,
"Partnering" text,
"Opponents in the final" text,
"Score" text
) | Who were the opponents of the final on June 23, 2003? | SELECT "Opponents in the final" FROM table_56425 WHERE "Date" = 'june 23, 2003' |
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 demographic (... | Provide the number of patients with bradycardia as their primary disease who were hospitalized for more than 5 days. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "BRADYCARDIA" AND demographic.days_stay > "5" |
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
amount number
)
CREATE TABLE chartevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
itemid number,
charttime ... | what is the name of the medication that was last prescribed to patient 26507 during the last month? | SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26507) AND DATETIME(prescriptions.startdate, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') ORDER BY prescriptions.startdate DESC LIMIT 1 |
CREATE TABLE table_28275 (
"Rank" real,
"Runs" real,
"Average" text,
"Strike rate" text,
"Player" text,
"Matches" real,
"Innings" real,
"Period" text
) | What is the smallest number of runs? | SELECT MIN("Runs") FROM table_28275 |
CREATE TABLE table_64988 (
"Name" text,
"Position" text,
"League Apps" text,
"League Goals" real,
"FA Cup Apps" real,
"FA Cup Goals" real,
"League Cup Apps" real,
"League Cup Goals" real,
"Total Apps" text,
"Total Goals" real
) | What's the total number of league cup apps when the league goals were less than 0? | SELECT COUNT("League Cup Apps") FROM table_64988 WHERE "League Goals" < '0' |
CREATE TABLE table_66696 (
"Res." text,
"Record" text,
"Opponent" text,
"Method" text,
"Event" text,
"Round" real,
"Time" text,
"Location" text
) | In what round was the loss at ufc 118? | SELECT "Round" FROM table_66696 WHERE "Res." = 'loss' AND "Event" = 'ufc 118' |
CREATE TABLE table_191105_3 (
first_aired INTEGER,
performed_by VARCHAR
) | When zachary sanders is the performer what is the lowerst first aired? | SELECT MIN(first_aired) FROM table_191105_3 WHERE performed_by = "Zachary Sanders" |
CREATE TABLE table_22548 (
"Rank" real,
"Name" text,
"Tenure" text,
"Leagues" text,
"Attempts" real,
"Completions" real,
"Comp %" text,
"Touchdowns" real,
"Interceptions" real,
"Yardage" real,
"QB Rating" text
) | What is the Quarterback rating of the player who got a comp percentage of 62.0? | SELECT "QB Rating" FROM table_22548 WHERE "Comp %" = '62.0' |
CREATE TABLE Sales (
sales_transaction_id INTEGER,
sales_details VARCHAR(255)
)
CREATE TABLE Lots (
lot_id INTEGER,
investor_id INTEGER,
lot_details VARCHAR(255)
)
CREATE TABLE Purchases (
purchase_transaction_id INTEGER,
purchase_details VARCHAR(255)
)
CREATE TABLE Investors (
invest... | For the sale details with amount smaller than 3000, visualize a bar chart that x-axis is the sales details and count them as y, I want to sort by the Y in desc. | SELECT sales_details, COUNT(sales_details) FROM Sales AS T1 JOIN Transactions AS T2 ON T1.sales_transaction_id = T2.transaction_id WHERE T2.amount_of_transaction < 3000 GROUP BY sales_details ORDER BY COUNT(sales_details) DESC |
CREATE TABLE table_name_56 (
record VARCHAR,
nationality VARCHAR,
date VARCHAR
) | What is the record for Norway on 23 august 1981? | SELECT record FROM table_name_56 WHERE nationality = "norway" AND date = "23 august 1981" |
CREATE TABLE table_35773 (
"Rank" real,
"Building" text,
"City" text,
"Height (m/ft)" text,
"Built" real
) | What is the sum of Rank with a build year earlier than 2007 for the howard johnson hotel bucharest? | SELECT SUM("Rank") FROM table_35773 WHERE "Built" < '2007' AND "Building" = 'howard johnson hotel bucharest' |
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 regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
... | 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 hire_date bin hire_date by time, and list by the sum employee id in ascending please. | SELECT HIRE_DATE, SUM(EMPLOYEE_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY SUM(EMPLOYEE_ID) |
CREATE TABLE table_29619494_2 (
apocalypstix VARCHAR,
denim_demons VARCHAR
) | List all the places that the Apocalypstix occupied when the Denim Demons were 2nd. | SELECT apocalypstix FROM table_29619494_2 WHERE denim_demons = "2nd" |
CREATE TABLE table_79418 (
"Time" text,
"Wind" text,
"Athlete" text,
"Nationality" text,
"Location of race" text,
"Date" text
) | Who was the athlete with a wind of 1.8? | SELECT "Athlete" FROM table_79418 WHERE "Wind" = '1.8' |
CREATE TABLE table_63803 (
"Player" text,
"Country" text,
"Year(s) won" text,
"Total" real,
"To par" text,
"Finish" text
) | Which player has a to par of +8? | SELECT "Player" FROM table_63803 WHERE "To par" = '+8' |
CREATE TABLE table_name_71 (
wins VARCHAR,
events VARCHAR,
rank VARCHAR
) | How many win total which has the rank smaller than 3 and events smaller than 22 | SELECT COUNT(wins) FROM table_name_71 WHERE events < 22 AND rank < 3 |
CREATE TABLE table_204_442 (
id number,
"institution" text,
"location" text,
"enrollment" number,
"nickname" text,
"varsity\nsports" number,
"rugby\nsince" text,
"head coach" text
) | when was the first year of rugby of the terrapins ? | SELECT "rugby\nsince" FROM table_204_442 WHERE "nickname" = 'terrapins' |
CREATE TABLE table_64940 (
"Player" text,
"Int'l Debut" text,
"Year" text,
"Cross Code Debut" text,
"Date" text
) | In what Year is Keith Smith's Cross Code Debut RL Test v Wales? | SELECT "Year" FROM table_64940 WHERE "Cross Code Debut" = 'rl test v wales' AND "Player" = 'keith smith' |
CREATE TABLE table_204_314 (
id number,
"pos" number,
"team" text,
"played" number,
"won" number,
"draw" number,
"lost" number,
"goals for" number,
"goals against" number,
"goal difference" number,
"points" number,
"notes" text
) | which two teams had the most draws ? | SELECT "team" FROM table_204_314 WHERE "draw" = (SELECT MAX("draw") FROM table_204_314) |
CREATE TABLE table_204_643 (
id number,
"release" number,
"artist" text,
"title" text,
"notes" text,
"album" text
) | what has been the last song this artist has made an other appearance on ? | SELECT "title" FROM table_204_643 ORDER BY id DESC LIMIT 1 |
CREATE TABLE table_38144 (
"Rank" real,
"Player" text,
"Country" text,
"Earnings ( $ )" real,
"Events" real,
"Wins" real
) | Events larger than 22, and a Earnings ( $ ) of 1,543,192, and a Rank smaller than 2 has the lowest wins? | SELECT MIN("Wins") FROM table_38144 WHERE "Events" > '22' AND "Earnings ( $ )" = '1,543,192' AND "Rank" < '2' |
CREATE TABLE ta (
campus_job_id int,
student_id int,
location varchar
)
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE student (
student_id int,
lastname varchar,
firstname varchar,
program_id int,
declare_major varchar,
total_credit int,
total... | Of the upper level elective classes that are taking place next semester , which ones do n't meet on Fridays ? | SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program_course, semester WHERE course_offering.friday = 'N' AND course.course_id = course_offering.course_id AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = 'FA' ... |
CREATE TABLE table_name_92 (
weeks_on_chart INTEGER,
position INTEGER
) | What is the sum of the weeks on a chart a song with a position less than 1 haas? | SELECT SUM(weeks_on_chart) FROM table_name_92 WHERE position < 1 |
CREATE TABLE table_20887670_1 (
affiliation VARCHAR,
mascot VARCHAR
) | what is the affiliation of the hilltoppers mascot? | SELECT affiliation FROM table_20887670_1 WHERE mascot = "Hilltoppers" |
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 ... | how many patients whose discharge location is rehab/distinct part hosp and primary disease is coronary artery disease? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "REHAB/DISTINCT PART HOSP" AND demographic.diagnosis = "CORONARY ARTERY DISEASE" |
CREATE TABLE table_name_67 (
pick VARCHAR,
player VARCHAR,
round VARCHAR
) | When Jeb Barlow was picked in round smaller than 7, how many player in totals were picked? | SELECT COUNT(pick) FROM table_name_67 WHERE player = "jeb barlow" AND round < 7 |
CREATE TABLE table_10213 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | Which Home team has a Home team score of 7.8 (50)? | SELECT "Home team" FROM table_10213 WHERE "Home team score" = '7.8 (50)' |
CREATE TABLE table_name_93 (
incumbent VARCHAR,
party VARCHAR,
district VARCHAR
) | Which democratic incumbent is from the district of ohio 7? | SELECT incumbent FROM table_name_93 WHERE party = "democratic" AND district = "ohio 7" |
CREATE TABLE table_34223 (
"Tournament" text,
"1990" text,
"1991" text,
"1992" text,
"1993" text,
"1994" text,
"1995" text,
"1996" text,
"1997" text,
"1998" text,
"Career SR" text,
"Career Win-Loss" text
) | What is the 1993 value of the 1997 Grand Slams? | SELECT "1993" FROM table_34223 WHERE "1997" = 'grand slams' |
CREATE TABLE table_name_43 (
venue VARCHAR,
date VARCHAR
) | Where was the match held on July 17, 1999? | SELECT venue FROM table_name_43 WHERE date = "july 17, 1999" |
CREATE TABLE actor (
Actor_ID int,
Name text,
Musical_ID int,
Character text,
Duration text,
age int
)
CREATE TABLE musical (
Musical_ID int,
Name text,
Year int,
Award text,
Category text,
Nominee text,
Result text
) | Show names of musicals and the number of actors who have appeared in the musicals in a bar chart, and could you rank from high to low by the bars? | SELECT T2.Name, COUNT(*) FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID GROUP BY T1.Musical_ID ORDER BY T2.Name DESC |
CREATE TABLE table_name_41 (
round INTEGER,
position VARCHAR,
overall VARCHAR
) | What is the average round in which a Safety with an overall rank higher than 89 was drafted? | SELECT AVG(round) FROM table_name_41 WHERE position = "safety" AND overall > 89 |
CREATE TABLE table_40477 (
"English" text,
"German" text,
"Dutch" text,
"Icelandic" text,
"Latin" text,
"Greek" text,
"Russian" text
) | What Dutch word has the same meaning as the Greek word (pl )? | SELECT "Dutch" FROM table_40477 WHERE "Greek" = 'πλέω (pléō)' |
CREATE TABLE table_name_93 (
country VARCHAR,
top_team VARCHAR,
edition VARCHAR
) | Which Country has a Top Team of jam, and an Edition of 31st? | SELECT country FROM table_name_93 WHERE top_team = "jam" AND edition = "31st" |
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... | has patient 010-6010 been admitted to hospital until 3 years ago? | SELECT COUNT(*) > 0 FROM patient WHERE patient.uniquepid = '010-6010' AND DATETIME(patient.hospitaladmittime) <= DATETIME(CURRENT_TIME(), '-3 year') |
CREATE TABLE table_name_39 (
home_team VARCHAR,
away_team VARCHAR
) | What was the home team's score when North Melbourne was the away team? | SELECT home_team AS score FROM table_name_39 WHERE away_team = "north melbourne" |
CREATE TABLE table_74856 (
"Year" text,
"Division" text,
"League" text,
"Reg. Season" text,
"Playoffs" text,
"Open Cup" text
) | when did the usl a-league have conference finals? | SELECT "Year" FROM table_74856 WHERE "League" = 'usl a-league' AND "Playoffs" = 'conference finals' |
CREATE TABLE table_28898948_3 (
date VARCHAR,
incumbent VARCHAR
) | When ihaia tainui is the incumbent what is the date? | SELECT date FROM table_28898948_3 WHERE incumbent = "Ihaia Tainui" |
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... | let me know the number of patients with procedure icd9 code 40 who were admitted in hospital before 2103. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2103" AND procedures.icd9_code = "40" |
CREATE TABLE table_75898 (
"Team" text,
"Year 2007" real,
"Year 2006" real,
"Year 2005" real,
"Change 06/07" text
) | What is the sum of Year 2007(s), when the Year 2005 is greater than 29,377? | SELECT SUM("Year 2007") FROM table_75898 WHERE "Year 2005" > '29,377' |
CREATE TABLE table_name_71 (
high_rebounds VARCHAR,
game VARCHAR
) | What is the High rebounds with a Game that is 62? | SELECT high_rebounds FROM table_name_71 WHERE game = 62 |
CREATE TABLE airports (
apid number,
name text,
city text,
country text,
x number,
y number,
elevation number,
iata text,
icao text
)
CREATE TABLE airlines (
alid number,
name text,
iata text,
icao text,
callsign text,
country text,
active text
)
CREATE ... | What is the number of routes that end at John F Kennedy International Airport? | SELECT COUNT(*) FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.dst_apid WHERE T1.name = 'John F Kennedy International Airport' |
CREATE TABLE table_41612 (
"Name" text,
"Subdivisions" text,
"Area (km\u00b2)" real,
"Population (1 July 2005 est.)" real,
"Population density (per km\u00b2)" real,
"Capital" text
) | What is the sum of Population (1 July 2005 est.), when Area (km ) is less than 5,131, when Population density (per km ) is less than 180, when Subdivisions is Parishes, and when Capital is Roseau? | SELECT SUM("Population (1 July 2005 est.)") FROM table_41612 WHERE "Area (km\u00b2)" < '5,131' AND "Population density (per km\u00b2)" < '180' AND "Subdivisions" = 'parishes' AND "Capital" = 'roseau' |
CREATE TABLE table_70068 (
"Rank" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
) | When the total was 11 and silver was greater than 4 what was the highest gold? | SELECT MAX("Gold") FROM table_70068 WHERE "Total" = '11' AND "Silver" > '4' |
CREATE TABLE event (
ID int,
Name text,
Stadium_ID int,
Year text
)
CREATE TABLE swimmer (
ID int,
name text,
Nationality text,
meter_100 real,
meter_200 text,
meter_300 text,
meter_400 text,
meter_500 text,
meter_600 text,
meter_700 text,
Time text
)
CREATE... | Draw a bar chart about the distribution of Time and ID . | SELECT Time, ID FROM swimmer |
CREATE TABLE table_name_19 (
game INTEGER,
score VARCHAR
) | Which Game has a Score of 3 6? | SELECT SUM(game) FROM table_name_19 WHERE score = "3–6" |
CREATE TABLE table_10251 (
"Class" text,
"Wheel arrangement" text,
"Manufacturer" text,
"Year made" text,
"Quantity made" text,
"Year(s) withdrawn" text
) | What year was the 4-6-0 Wheel model train from 1908 withdrawn? | SELECT "Year(s) withdrawn" FROM table_10251 WHERE "Wheel arrangement" = '4-6-0' AND "Year made" = '1908' |
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... | what is the drug patient 009-5351 has been allergic to until 11/2105? | SELECT allergy.drugname FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-5351')) AND STRFTIME('%y-%m', allergy.allergytime) <= '2105-11' |
CREATE TABLE table_8564 (
"Rank" real,
"Surname" text,
"Number of bearers 2008" real,
"Type" text,
"Etymology" text
) | What did the Surname Lindberg rank? | SELECT COUNT("Rank") FROM table_8564 WHERE "Surname" = 'lindberg' |
CREATE TABLE table_name_22 (
apps INTEGER,
level INTEGER
) | What is the lowest Apps with more than 1 level? | SELECT MIN(apps) FROM table_name_22 WHERE level > 1 |
CREATE TABLE table_train_260 (
"id" int,
"leukocyte_deficiencies" bool,
"bleeding" int,
"hemoglobin_a1c_hba1c" float,
"leukocyte_dysfunction" bool,
"renal_disease" bool,
"hba1c" float,
"serum_creatinine" float,
"NOUSE" float
) | history of leukocyte dysfunction and deficiencies | SELECT * FROM table_train_260 WHERE leukocyte_dysfunction = 1 AND leukocyte_deficiencies = 1 |
CREATE TABLE table_9116 (
"Club" text,
"Played" text,
"Drawn" text,
"Lost" text,
"Points for" text,
"Points against" text,
"Tries for" text,
"Tries against" text,
"Try bonus" text,
"Losing bonus" text,
"Points" text
) | What was the losing bonus for the 20 played, and 353 points? | SELECT "Losing bonus" FROM table_9116 WHERE "Played" = '20' AND "Points for" = '353' |
CREATE TABLE table_name_77 (
venue VARCHAR,
opponent VARCHAR
) | where did rochdale play as opponent? | SELECT venue FROM table_name_77 WHERE opponent = "rochdale" |
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
... | what was the last prescribed dose of erythromycin 0.5% ophth oint that patient 73693 got the last month? | SELECT prescriptions.dose_val_rx FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 73693) AND prescriptions.drug = 'erythromycin 0.5% ophth oint' AND DATETIME(prescriptions.startdate, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', ... |
CREATE TABLE table_name_10 (
points_against VARCHAR,
tries_against VARCHAR,
played VARCHAR,
losing_bonus VARCHAR
) | For teams with 22 matches played, a losing bonus of 3, and 45 tries against, what was the number of points against? | SELECT points_against FROM table_name_10 WHERE played = "22" AND losing_bonus = "3" AND tries_against = "45" |
CREATE TABLE table_name_66 (
league_goals VARCHAR,
league_cup_goals VARCHAR,
scorer VARCHAR
) | What is the number of league goals when Bill Dearden was the scorer and there was 0 league cup goals? | SELECT league_goals FROM table_name_66 WHERE league_cup_goals = "0" AND scorer = "bill dearden" |
CREATE TABLE table_66550 (
"Manufacturer" text,
"Transmission" text,
"Engine Capacity" real,
"Fuel Type" text,
"L/100km Urban (Cold)" real,
"L/100km Extra-Urban" real,
"L/100km Combined" real,
"mpg-UK Urban (Cold)" real,
"mpg-UK Extra-Urban" real,
"mpg-UK Combined" real,
"mpg... | What's the total L/100km extra urban fueled by diesel, when the mpg-UK combines is more than 19.2, mpg-US is less than 50 and the L/100m combined is less than 5.7? | SELECT COUNT("L/100km Extra-Urban") FROM table_66550 WHERE "mpg-UK Combined" > '19.2' AND "L/100km Combined" < '5.7' AND "Fuel Type" = 'diesel' AND "mpg-US Combined" < '50' |
CREATE TABLE table_name_38 (
place VARCHAR,
score VARCHAR
) | What place is the player with score of 70-68-70=208 from? | SELECT place FROM table_name_38 WHERE score = 70 - 68 - 70 = 208 |
CREATE TABLE table_12670 (
"Mininera DFL" text,
"Wins" real,
"Byes" real,
"Losses" real,
"Draws" real,
"Against" real
) | How many byes for the team with more than 14 losses and more than 0 wins? | SELECT AVG("Byes") FROM table_12670 WHERE "Losses" > '14' AND "Wins" > '0' |
CREATE TABLE table_27487336_1 (
rushing_yards_per_game VARCHAR,
season VARCHAR
) | What is every value for rushing yards per game if the season is 1984? | SELECT rushing_yards_per_game FROM table_27487336_1 WHERE season = "1984" |
CREATE TABLE table_24126518_2 (
attendance INTEGER,
final_score VARCHAR
) | Name the least attendance for l 36 1 | SELECT MIN(attendance) FROM table_24126518_2 WHERE final_score = "L 36–1" |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime t... | what were the five specimen tests that were most frequently given to patients that were previously diagnosed with obtundation in the same month in the last year? | SELECT t3.culturesite FROM (SELECT t2.culturesite, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'obtundation' AND DATETIME(diagnosis.diagnosi... |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid num... | in 2105 how many patients with s/p surgery for cancer - rectal were diagnosed within the same hospital visit after previously being diagnosed with myocardial infarction ruled out? | SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 's/p surgery for cancer - rectal' AND STRFTIME('%y', diagnosis.diagnosisti... |
CREATE TABLE table_name_44 (
club VARCHAR,
played VARCHAR,
tries_for VARCHAR
) | What is the Club, when the value for Played is 22, and when the value for Tries is 41? | SELECT club FROM table_name_44 WHERE played = "22" AND tries_for = "41" |
CREATE TABLE table_name_95 (
sweet_sixteen VARCHAR,
conference VARCHAR
) | What Sweet Sixteen team is in the Colonial conference? | SELECT sweet_sixteen FROM table_name_95 WHERE conference = "colonial" |
CREATE TABLE table_name_50 (
fa_cup_apps VARCHAR,
fa_cup_goals VARCHAR,
total_apps VARCHAR,
league_apps VARCHAR
) | What FA cup apps has a total larger than 12 and league apps larger than 38, and FA Cup goals larger than 1? | SELECT COUNT(fa_cup_apps) FROM table_name_50 WHERE total_apps > 12 AND league_apps > 38 AND fa_cup_goals > 1 |
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 text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
... | what is the number of patients whose death status is 0 and primary disease is hypertension;rule out coronary artery disease\cardiac cath? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.expire_flag = "0" AND demographic.diagnosis = "HYPERTENSION;RULE OUT CORONARY ARTERY DISEASE\CARDIAC CATH" |
CREATE TABLE table_64709 (
"Group" text,
"Name" text,
"Nationality" text,
"4.00" text,
"Result" text
) | Alana Boyd of group B with a 4.30 result has what nationality? | SELECT "Nationality" FROM table_64709 WHERE "Group" = 'b' AND "Result" = '4.30' AND "Name" = 'alana boyd' |
CREATE TABLE table_23292220_4 (
first_broadcast VARCHAR,
episode VARCHAR
) | What was the first broadcast date of episode 4x03? | SELECT first_broadcast FROM table_23292220_4 WHERE episode = "4x03" |
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... | % downvoted questions per tag. | SELECT t.TagName, t.Count AS "# of questions", ROUND(100.0 * (t.Count - COUNT(*)) / t.Count, 2) AS "% downvoted" FROM Tags AS t INNER JOIN PostTags AS pt ON t.Id = pt.TagId LEFT OUTER JOIN Votes AS v ON v.PostId = pt.PostId AND v.VoteTypeId = 3 WHERE v.PostId IS NULL GROUP BY t.TagName, t.Count ORDER BY ROUND(100.0 * (... |
CREATE TABLE table_51831 (
"Year" real,
"Competition" text,
"Venue" text,
"Position" text,
"Event" text,
"Notes" text
) | What year was the Competition of World Junior Championships with a 20th (qf) position? | SELECT AVG("Year") FROM table_51831 WHERE "Competition" = 'world junior championships' AND "Position" = '20th (qf)' |
CREATE TABLE table_70937 (
"Team" text,
"Manager 1" text,
"Captain" text,
"Kit manufacturer" text,
"Shirt sponsor" text
) | Who was the team captain for Crystal Palace? | SELECT "Captain" FROM table_70937 WHERE "Team" = 'crystal palace' |
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
DeletionDate time,
ReviewTaskStateId number,
PostId number,
SuggestedEditId number,
CompletedByReviewTaskId number
)
CREATE TABLE Posts (
Id number,
PostTypeId number,
AcceptedAnswerId number,
... | Questions with dependency-injection and dagger-2 tag. | SELECT Id, AcceptedAnswerId, CreationDate FROM Posts WHERE Tags LIKE '%dependency-injection%' AND Tags LIKE '%dagger-2%' |
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... | find the number of patients with primary disease as s/p fall and their year of death is in or before 2112. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "S/P FALL" AND demographic.dod_year <= "2112.0" |
CREATE TABLE photos (
id int,
camera_lens_id int,
mountain_id int,
color text,
name text
)
CREATE TABLE mountain (
id int,
name text,
Height real,
Prominence real,
Range text,
Country text
)
CREATE TABLE camera_lens (
id int,
brand text,
name text,
focal_len... | Return a bar chart on what are the id and name of the mountains that have at least 2 photos?, list from high to low by the bar. | SELECT T1.name, T1.id FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id ORDER BY T1.name DESC |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
sy... | what was the daily minimum amount of urine given to patient 002-38644 until 01/05/2104? | SELECT MIN(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-38644')) AND intakeoutput.celllabel = 'urine... |
CREATE TABLE table_name_40 (
weeks_on_chart INTEGER,
position VARCHAR,
year VARCHAR
) | What is the average weeks of a song with a larger than 3 position after 1977? | SELECT AVG(weeks_on_chart) FROM table_name_40 WHERE position > 3 AND year > 1977 |
CREATE TABLE table_204_576 (
id number,
"year" number,
"best" text,
"location" text,
"date" text,
"world rank" text
) | who had the best time ostrava or berlin ? | SELECT "location" FROM table_204_576 WHERE "location" IN ('ostrava', 'berlin') ORDER BY "best" LIMIT 1 |
CREATE TABLE ReviewTaskResultTypes (
Id number,
Name text,
Description text
)
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConce... | Highest answer rate of popular tags. | SELECT Tags.TagName, COUNT(*) AS NumQuestions, SUM(CASE WHEN NOT AcceptedAnswerId IS NULL THEN 1 ELSE 0 END) AS NumAnswered, (SUM(CASE WHEN NOT AcceptedAnswerId IS NULL THEN 1 ELSE 0 END) * 100 / COUNT(*)) AS PercentageAnswered FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts ON Posts.Id = Pos... |
CREATE TABLE table_name_12 (
transfer_window VARCHAR,
moving_to VARCHAR
) | Name the transfer window of realmadrid | SELECT transfer_window FROM table_name_12 WHERE moving_to = "realmadrid" |
CREATE TABLE table_name_34 (
pick VARCHAR,
position VARCHAR
) | Which pick number resulted in a defensive end? | SELECT pick FROM table_name_34 WHERE position = "defensive end" |
CREATE TABLE table_204_204 (
id number,
"rank" number,
"heat" number,
"country" text,
"cyclists" text,
"result" number,
"notes" text
) | which country took the least amount of time ? | SELECT "country" FROM table_204_204 ORDER BY "result" LIMIT 1 |
CREATE TABLE table_name_15 (
mintage VARCHAR,
theme VARCHAR
) | What was the mintage when the theme was Santa Claus? | SELECT mintage FROM table_name_15 WHERE theme = "santa claus" |
CREATE TABLE table_47674 (
"Team 1" text,
"Agg." text,
"Team 2" text,
"1st leg" text,
"2nd leg" text
) | What is Team 2, when 2nd Leg is 1-0? | SELECT "Team 2" FROM table_47674 WHERE "2nd leg" = '1-0' |
CREATE TABLE table_13483 (
"Place" text,
"Player" text,
"Country" text,
"Score" real,
"To par" text
) | What player has a score less than 66, and a Place of t2, in the United States? | SELECT "Player" FROM table_13483 WHERE "Score" < '66' AND "Place" = 't2' AND "Country" = 'united states' |
CREATE TABLE table_9344 (
"Episode" text,
"7 Deadly Sin" text,
"Challenge Winner" text,
"Challenge Loser" text,
"Voted In To 'El Duelo'" text,
"Eliminated" text
) | Which winner has a Challenge Loser of gisel? | SELECT "Challenge Winner" FROM table_9344 WHERE "Challenge Loser" = 'gisel' |
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,
round_trip_required varchar
)
CREATE TABLE time_zone (
time_zone_code text,
time_zone_name ... | show me all flights from PITTSBURGH to BOSTON both direct and connecting that depart PITTSBURGH after 1900 | 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_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND flight.departure_time > 1900 AND flight.to_airport = AIRPORT_SERVICE_1.airpor... |
CREATE TABLE table_13114949_3 (
event VARCHAR,
qualifying_score VARCHAR
) | how many times was the qualifying score 60.750? | SELECT COUNT(event) FROM table_13114949_3 WHERE qualifying_score = "60.750" |
CREATE TABLE table_name_88 (
points INTEGER,
winnings VARCHAR,
car__number VARCHAR
) | How many points did the driver who won $127,541 driving car #31 get? | SELECT MAX(points) FROM table_name_88 WHERE winnings = "$127,541" AND car__number > 31 |
CREATE TABLE table_36500 (
"Arabic" text,
"English" text,
"Maltese" text,
"Turkish" text,
"Somali" text,
"Persian" text,
"Urdu" text,
"Hindi" text,
"Punjabi (India)" text,
"Punjabi (Pakistan)" text,
"Malayalam" text,
"Bangla" text,
"Hebrew" text,
"Indonesian" text... | What is the Turkish word for the Bangla word shombar ? | SELECT "Turkish" FROM table_36500 WHERE "Bangla" = 'shombar সোমবার' |
CREATE TABLE table_name_30 (
pick INTEGER,
name VARCHAR,
overall VARCHAR
) | What is the lowest draft pick number for mark doak who had an overall pick smaller than 147? | SELECT MIN(pick) FROM table_name_30 WHERE name = "mark doak" AND overall < 147 |
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE chartevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE admissions (
... | what was the last time that patient 32153 received a lab test since 06/2105? | SELECT labevents.charttime FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 32153) AND STRFTIME('%y-%m', labevents.charttime) >= '2105-06' ORDER BY labevents.charttime DESC LIMIT 1 |
CREATE TABLE table_30035 (
"Semitological abbreviation" text,
"Hebrew name" text,
"Arabic name" text,
"Morphological category" text,
"Hebrew Form" text,
"Arabic form" text,
"Approximate translation" text
) | What are the approximate translations when the morphological category is masc. sing. active participle? | SELECT "Approximate translation" FROM table_30035 WHERE "Morphological category" = 'masc. sing. active participle' |
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_type text,... | what were the three most frequently given procedures for patients who had already had thoracentesis within the same month in 2102? | SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.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, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admi... |
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
value number
)
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
CREATE TABLE d_labitems (
row_i... | how many patients in 2105 have received closed bronchial biopsy in the same hospital visit after receiving hemodialysis? | SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, procedures_icd.charttime, admissions.hadm_id FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_... |
CREATE TABLE aircraft (
aircraft_code varchar,
aircraft_description varchar,
manufacturer varchar,
basic_type varchar,
engines int,
propulsion varchar,
wide_body varchar,
wing_span int,
length int,
weight int,
capacity int,
pay_load int,
cruising_speed int,
range_... | BALTIMORE to PHILADELPHIA | 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 = 'BALTIMORE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHIL... |
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 prescriptions... | give me the number of patients whose admission type is emergency and diagnoses long title is abnormal involuntary movements? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND diagnoses.long_title = "Abnormal involuntary movements" |
CREATE TABLE table_name_63 (
venue VARCHAR,
year VARCHAR,
result VARCHAR
) | What is Venue, when Year is 2005, and when Result is 8th? | SELECT venue FROM table_name_63 WHERE year = 2005 AND result = "8th" |
CREATE TABLE table_234 (
"Season" real,
"Season premiere" text,
"Season finale" text,
"TV season" text,
"Ranking" text,
"Viewers (in millions)" text
) | When did the season air where the viewership was 14.71 million? | SELECT "Season premiere" FROM table_234 WHERE "Viewers (in millions)" = '14.71' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.