instruction stringlengths 151 7.46k | output stringlengths 2 4.44k | source stringclasses 26
values |
|---|---|---|
CREATE TABLE t_kc24 (
ACCOUNT_DASH_DATE time,
ACCOUNT_DASH_FLG number,
CASH_PAY number,
CIVIL_SUBSIDY number,
CKC102 number,
CLINIC_ID text,
CLINIC_SLT_DATE time,
COMP_ID text,
COM_ACC_PAY number,
COM_PAY number,
DATA_ID text,
ENT_ACC_PAY number,
ENT_PAY number,
F... | SELECT * FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '4112809' AND gwyjzb.IN_HOSP_DATE BETWEEN '2002-05-16' AND '2019-10-05' UNION SELECT * FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '4112809' AND fgwyjzb.IN_HOSP_DATE BETWEEN '2002-05-16' AND '2019-10-05' EXCEPT SELECT * FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '411280... | css |
CREATE TABLE table_19516 (
"No." real,
"Station Code" text,
"Station" text,
"Arrival" text,
"Departure" text,
"Kilometers" real,
"Day" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what is the arrival time where the station code is awy?
| SELECT "Arrival" FROM table_19516 WHERE "Station Code" = 'AWY' | wikisql |
CREATE TABLE table_name_68 (
silver INTEGER,
rank VARCHAR,
total VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the lowest number of silver medals with a rank of 4 and total medals greater than 1?
| SELECT MIN(silver) FROM table_name_68 WHERE rank = 4 AND total > 1 | sql_create_context |
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... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "43" AND lab.label = "Epithelial Cells" | mimicsql_data |
CREATE TABLE table_204_346 (
id number,
"#" number,
"date" text,
"venue" text,
"opponent" text,
"result" text,
"competition" text,
"scored" number
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what is the number of goals scored in the algarv... | SELECT "scored" FROM table_204_346 WHERE "date" = '5 march 2002' | squall |
CREATE TABLE table_64946 (
"Player" text,
"Country" text,
"Year(s) won" text,
"Total" real,
"To par" text,
"Finish" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who won in 1988 with a total less than 287?
| SELECT "Player" FROM table_64946 WHERE "Total" < '287' AND "Year(s) won" = '1988' | wikisql |
CREATE TABLE table_29439 (
"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 (millions)" text
)
-- Using valid SQLite, answer the following questions for the tables provided a... | SELECT "Title" FROM table_29439 WHERE "Production code" = '2ARG09' | wikisql |
CREATE TABLE table_203_798 (
id number,
"party" text,
"votes" text,
"%" number,
"swing" number,
"seats" number,
"change" number
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what party had the least number of seats ?
| SELECT "party" FROM table_203_798 ORDER BY "seats" LIMIT 1 | squall |
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 varchar,
state varchar,
country varchar,
zip int
)
CREATE TABLE comment_instructor (
instructor_id int,
... | SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.course_id WHERE program_cour... | advising |
CREATE TABLE table_28037619_2 (
written_by VARCHAR,
us_viewers__million_ VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many people wrote the episode that had 7.26 million u.s. viewers?
| SELECT COUNT(written_by) FROM table_28037619_2 WHERE us_viewers__million_ = "7.26" | sql_create_context |
CREATE TABLE table_78424 (
"Driver" text,
"Constructor" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the largest number of laps with a Grid larger than 14, a Time/Retired of + 2 laps, and a Dr... | SELECT MAX("Laps") FROM table_78424 WHERE "Grid" > '14' AND "Time/Retired" = '+ 2 laps' AND "Driver" = 'helmut marko' | wikisql |
CREATE TABLE album (
albumid number,
title text,
artistid number
)
CREATE TABLE playlisttrack (
playlistid number,
trackid number
)
CREATE TABLE genre (
genreid number,
name text
)
CREATE TABLE artist (
artistid number,
name text
)
CREATE TABLE invoiceline (
invoicelineid num... | SELECT title FROM album ORDER BY title | spider |
CREATE TABLE table_55954 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Where attendance is 79,431 what is date?
| SELECT "Date" FROM table_55954 WHERE "Attendance" = '79,431' | wikisql |
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 prescription... | 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 = "Cellulitis and abscess of leg, except foot" AND prescriptions.route = "PO" | mimicsql_data |
CREATE TABLE table_40037 (
"Country" text,
"Local name" text,
"Host" text,
"Network" text,
"Date premiered" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Country has a Network of channel 1?
| SELECT "Country" FROM table_40037 WHERE "Network" = 'channel 1' | wikisql |
CREATE TABLE table_dev_35 (
"id" int,
"white_blood_cell_count_wbc" int,
"platelets" int,
"neutrophil_count" int,
"serum_creatinine" float,
"albumin" float,
"NOUSE" float
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- neutrophil count >= 1500 / mm... | SELECT * FROM table_dev_35 WHERE neutrophil_count >= 1500 | criteria2sql |
CREATE TABLE hz_info (
KH text,
KLX number,
RYBH text,
YLJGDM text
)
CREATE TABLE mzjzjlb (
HXPLC number,
HZXM text,
JLSJ time,
JZJSSJ time,
JZKSBM text,
JZKSMC text,
JZKSRQ time,
JZLSH text,
JZZDBM text,
JZZDSM text,
JZZTDM number,
JZZTMC text,
KH te... | SELECT zyjzjlb.JZLSH FROM hz_info JOIN zyjzjlb JOIN hz_info_zyjzjlb ON hz_info.YLJGDM = hz_info_zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX AND hz_info_zyjzjlb.JZLSH = zyjzjlb.JZLSH AND hz_info_zyjzjlb.YLJGDM = hz_info_zyjzjlb.YLJGDM AND hz_info_zyjzjlb.JZLSH = zyjzjlb.JZLSH AND hz_info_zyj... | css |
CREATE TABLE t_kc22 (
AMOUNT number,
CHA_ITEM_LEV number,
DATA_ID text,
DIRE_TYPE number,
DOSE_FORM text,
DOSE_UNIT text,
EACH_DOSAGE text,
EXP_OCC_DATE time,
FLX_MED_ORG_ID text,
FXBZ number,
HOSP_DOC_CD text,
HOSP_DOC_NM text,
MED_CLINIC_ID text,
MED_DIRE_CD tex... | SELECT qtb.OUT_DIAG_DIS_CD, qtb.OUT_DIAG_DIS_NM FROM qtb WHERE qtb.MED_CLINIC_ID = '13686436304' UNION SELECT gyb.OUT_DIAG_DIS_CD, gyb.OUT_DIAG_DIS_NM FROM gyb WHERE gyb.MED_CLINIC_ID = '13686436304' UNION SELECT zyb.OUT_DIAG_DIS_CD, zyb.OUT_DIAG_DIS_NM FROM zyb WHERE zyb.MED_CLINIC_ID = '13686436304' UNION SELECT mzb.... | css |
CREATE TABLE table_203_320 (
id number,
"rank in\n2011" number,
"name of\nconcern" text,
"location of\nheadquarters" text,
"revenue\n(thou.\npln)" number,
"profit\n(thou.\npln)" number,
"employees" number
)
-- Using valid SQLite, answer the following questions for the tables provided above... | SELECT COUNT("name of\nconcern") FROM table_203_320 WHERE "profit\n(thou.\npln)" > 1000000 | squall |
CREATE TABLE table_name_82 (
played VARCHAR,
points_difference VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What are the played points difference?
| SELECT played FROM table_name_82 WHERE points_difference = "points difference" | sql_create_context |
CREATE TABLE table_80210 (
"Year" real,
"Entrant" text,
"Chassis" text,
"Engine" text,
"Points" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What chassis did the porsche flat-4 use before 1958?
| SELECT "Chassis" FROM table_80210 WHERE "Engine" = 'porsche flat-4' AND "Year" < '1958' | wikisql |
CREATE TABLE table_12032893_1 (
_number VARCHAR,
name VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What number (#) is associated with the Name Ron Baxter?
| SELECT COUNT(_number) FROM table_12032893_1 WHERE name = "Ron Baxter" | sql_create_context |
CREATE TABLE editor (
Editor_ID int,
Name text,
Age real
)
CREATE TABLE journal (
Journal_ID int,
Date text,
Theme text,
Sales int
)
CREATE TABLE journal_committee (
Editor_ID int,
Journal_ID int,
Work_Type text
)
-- Using valid SQLite, answer the following questions for the ... | SELECT Name, Age FROM editor ORDER BY Name | nvbench |
CREATE TABLE table_name_19 (
margin_of_victory VARCHAR,
runner_s__up VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Margin of victory has a Runner(s)-up of mark o'meara?
| SELECT margin_of_victory FROM table_name_19 WHERE runner_s__up = "mark o'meara" | sql_create_context |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2115" AND procedures.long_title = "Insertion of non-drug-eluting coronary artery stent(s)" | mimicsql_data |
CREATE TABLE table_17773 (
"Sequencer" text,
"Ion Torrent PGM" text,
"454 GS FLX" text,
"HiSeq 2000" text,
"SOLiDv4" text,
"PacBio" text,
"Sanger 3730xl" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the sequencer when ion torrent p... | SELECT "Sequencer" FROM table_17773 WHERE "Ion Torrent PGM" = '200-400 bp' | wikisql |
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 lab (
subject_id text,
hadm_id text,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND lab.label = "Creatine Kinase, MB Isoenzyme" | mimicsql_data |
CREATE TABLE table_26428602_1 (
absorb__nm_ INTEGER,
color VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How much absorption in nm does the orange dye have?
| SELECT MIN(absorb__nm_) FROM table_26428602_1 WHERE color = "orange" | sql_create_context |
CREATE TABLE table_204_565 (
id number,
"game" number,
"date" text,
"opponent" text,
"venue" text,
"result" text,
"attendance" number,
"goalscorers" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- how many games were played in september 1... | SELECT COUNT(*) FROM table_204_565 WHERE "date" = 9 AND "date" = 1978 | squall |
CREATE TABLE table_name_88 (
year INTEGER,
points VARCHAR,
chassis VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which year has a total of 0 points and a chassis of Toleman tg181?
| SELECT AVG(year) FROM table_name_88 WHERE points = 0 AND chassis = "toleman tg181" | sql_create_context |
CREATE TABLE course_prerequisite (
pre_course_id int,
course_id int
)
CREATE TABLE program_requirement (
program_id int,
category varchar,
min_credit int,
additional_req varchar
)
CREATE TABLE area (
course_id int,
area varchar
)
CREATE TABLE comment_instructor (
instructor_id int... | SELECT DISTINCT department, name, number FROM course WHERE (description LIKE '%International Economics%' OR name LIKE '%International Economics%') AND credits = 3 | advising |
CREATE TABLE mzjzjlb (
HXPLC number,
HZXM text,
JLSJ time,
JZJSSJ time,
JZKSBM text,
JZKSMC text,
JZKSRQ time,
JZLSH text,
JZZDBM text,
JZZDSM text,
JZZTDM number,
JZZTMC text,
KH text,
KLX number,
MJZH text,
ML number,
MZZYZDZZBM text,
MZZYZDZZMC ... | SELECT jybgb.SHSJ FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN hz_info_mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB ... | css |
CREATE TABLE table_24187 (
"No in Series" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" real,
"U.S. viewers (millions)" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What episode numb... | SELECT MAX("No in Series") FROM table_24187 WHERE "Directed by" = 'John Behring' | wikisql |
CREATE TABLE table_10710 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the home score for the Home team Melbou... | SELECT "Home team score" FROM table_10710 WHERE "Home team" = 'melbourne' | wikisql |
CREATE TABLE table_2076516_1 (
enrollment__2012_ VARCHAR,
founded VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When 1927 is the founded year how many measurements of enrollment in 2012 are there?
| SELECT COUNT(enrollment__2012_) FROM table_2076516_1 WHERE founded = 1927 | sql_create_context |
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
... | SELECT COUNT(DISTINCT t2.uniquepid) FROM (SELECT t1.uniquepid, t1.diagnosistime, t1.patienthealthsystemstayid FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = ... | eicu |
CREATE TABLE table_name_93 (
census_ranking VARCHAR,
area_km_2 VARCHAR,
population VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the census ranking for the community with an area smaller than 9.94 km2 and a population smaller than 817?
| SELECT census_ranking FROM table_name_93 WHERE area_km_2 < 9.94 AND population < 817 | sql_create_context |
CREATE TABLE t_kc22 (
AMOUNT number,
CHA_ITEM_LEV number,
DATA_ID text,
DIRE_TYPE number,
DOSE_FORM text,
DOSE_UNIT text,
EACH_DOSAGE text,
EXP_OCC_DATE time,
FLX_MED_ORG_ID text,
FXBZ number,
HOSP_DOC_CD text,
HOSP_DOC_NM text,
MED_CLINIC_ID text,
MED_DIRE_CD tex... | SELECT COUNT(qtb.PERSON_ID) FROM qtb WHERE qtb.IN_DIAG_DIS_NM = '腔隙性脑梗死' UNION SELECT COUNT(gyb.PERSON_ID) FROM gyb WHERE gyb.IN_DIAG_DIS_NM = '腔隙性脑梗死' UNION SELECT COUNT(zyb.PERSON_ID) FROM zyb WHERE zyb.IN_DIAG_DIS_NM = '腔隙性脑梗死' UNION SELECT COUNT(mzb.PERSON_ID) FROM mzb WHERE mzb.IN_DIAG_DIS_NM = '腔隙性脑梗死' | css |
CREATE TABLE table_name_5 (
away_team VARCHAR,
home_team VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the away team when the home team is Cheltenham Town?
| SELECT away_team FROM table_name_5 WHERE home_team = "cheltenham town" | sql_create_context |
CREATE TABLE table_204_622 (
id number,
"year" number,
"competition" text,
"venue" text,
"position" text,
"event" text,
"notes" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- which competition did this competitor compete in next after the wo... | SELECT "competition" FROM table_204_622 WHERE id = (SELECT id FROM table_204_622 WHERE "competition" = 'world indoor championships' AND "year" = 2008) + 1 | squall |
CREATE TABLE table_29842201_1 (
subject VARCHAR,
highest_mark VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the subject when the highest mark is 79?
| SELECT subject FROM table_29842201_1 WHERE highest_mark = 79 | sql_create_context |
CREATE TABLE table_name_2 (
tournament VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which 2010 stat featured the tournament of the Olympic Games?
| SELECT 2010 FROM table_name_2 WHERE tournament = "olympic games" | sql_create_context |
CREATE TABLE table_56631 (
"Pick #" real,
"CFL Team" text,
"Player" text,
"Position" text,
"College" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Position has a Player of patrick macdonald?
| SELECT "Position" FROM table_56631 WHERE "Player" = 'patrick macdonald' | wikisql |
CREATE TABLE table_68328 (
"Sydney" text,
"Melbourne" text,
"Perth" text,
"Adelaide" text,
"Gold Coast" text,
"Auckland" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Perth's gold coast and Adelaide were yes when Auckland was no?
| SELECT "Perth" FROM table_68328 WHERE "Gold Coast" = 'yes' AND "Adelaide" = 'yes' AND "Auckland" = 'no' | wikisql |
CREATE TABLE captain (
Captain_ID int,
Name text,
Ship_ID int,
age text,
Class text,
Rank text
)
CREATE TABLE Ship (
Ship_ID int,
Name text,
Type text,
Built_Year real,
Class text,
Flag text
)
-- Using valid SQLite, answer the following questions for the tables provide... | SELECT Class, COUNT(Class) FROM captain GROUP BY Class ORDER BY COUNT(Class) DESC | nvbench |
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId number,
CreationDate time,
BountyAmount number
)
CREATE TABLE Users (
Id number,
Reputation number,
CreationDate time,
DisplayName text,
LastAccessDate time,
WebsiteUrl text,
Location text,
... | WITH canon AS (SELECT Tags.Id, Count, Tags.TagName AS otag, COALESCE(c.TargetTagName, b.TargetTagName, a.TargetTagName, TagName) AS tagname FROM Tags LEFT JOIN TagSynonyms AS a ON (a.SourceTagName = TagName) LEFT JOIN TagSynonyms AS b ON (b.SourceTagName = a.TargetTagName) LEFT JOIN TagSynonyms AS c ON (c.SourceTagName... | sede |
CREATE TABLE artist (
Artist_ID int,
Name text,
Country text,
Year_Join int,
Age int
)
CREATE TABLE exhibition_record (
Exhibition_ID int,
Date text,
Attendance int
)
CREATE TABLE exhibition (
Exhibition_ID int,
Year int,
Theme text,
Artist_ID int,
Ticket_Price real... | SELECT Year, COUNT(Year) FROM exhibition WHERE Ticket_Price < 15 GROUP BY Theme | nvbench |
CREATE TABLE table_23739 (
"County" text,
"Obama%" text,
"Obama#" real,
"McCain%" text,
"McCain#" real,
"Others%" text,
"Others#" real,
"Total" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the county for mccain being 38.78%
| SELECT "County" FROM table_23739 WHERE "McCain%" = '38.78%' | wikisql |
CREATE TABLE table_29866 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what i... | SELECT COUNT("Record") FROM table_29866 WHERE "Date" = 'October 6' | wikisql |
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... | SELECT demographic.days_stay, demographic.admittime FROM demographic WHERE demographic.subject_id = "4333" | mimicsql_data |
CREATE TABLE table_1346137_4 (
candidates VARCHAR,
incumbent VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many different set of candidates were there when the incumbent was david e. finley?
| SELECT COUNT(candidates) FROM table_1346137_4 WHERE incumbent = "David E. Finley" | sql_create_context |
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 text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "14" AND prescriptions.route = "OU" | mimicsql_data |
CREATE TABLE table_name_52 (
nationality VARCHAR,
fate VARCHAR,
ship VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the nationality of the sunk ship named Rinos?
| SELECT nationality FROM table_name_52 WHERE fate = "sunk" AND ship = "rinos" | sql_create_context |
CREATE TABLE table_name_69 (
livery VARCHAR,
year_built VARCHAR,
locomotive_type VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What livery belongs to the steam Locomotive type builder that was building before 1989?
| SELECT livery FROM table_name_69 WHERE year_built < 1989 AND locomotive_type = "steam" | sql_create_context |
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
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 countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
... | SELECT HIRE_DATE, DEPARTMENT_ID FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY HIRE_DATE DESC | nvbench |
CREATE TABLE table_50913 (
"Round" real,
"Player" text,
"Position" text,
"Nationality" text,
"College/Junior/Club Team (League)" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who is the player from round 8?
| SELECT "Player" FROM table_50913 WHERE "Round" = '8' | wikisql |
CREATE TABLE table_name_79 (
gold VARCHAR,
total VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is Gold, when Total is 6?
| SELECT gold FROM table_name_79 WHERE total = 6 | sql_create_context |
CREATE TABLE table_204_54 (
id number,
"pondicherry assembly" text,
"duration" text,
"name of m.l.a." text,
"party affiliation" text,
"election year" number
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- who won the election after s. sivaprakasam in ... | SELECT "name of m.l.a." FROM table_204_54 WHERE "pondicherry assembly" = 'fifth' | squall |
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAddress text
)
CREATE TABLE R... | SELECT Tags FROM Posts WHERE Tags IN (SELECT Tags FROM Tags ORDER BY Count DESC LIMIT 10) LIMIT 5 | sede |
CREATE TABLE table_29563 (
"A\u00f1o" real,
"Trabajo nominado" text,
"Premio" text,
"Categor\u00eda" text,
"Country" text,
"Resultado" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many premio are there when 'Artist of the Year' was the cat... | SELECT COUNT("Premio") FROM table_29563 WHERE "Categor\u00eda" = 'Artist of the Year' | wikisql |
CREATE TABLE table_name_67 (
points INTEGER,
played INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Can you tell me the highest Points that has the Played smaller than 30?
| SELECT MAX(points) FROM table_name_67 WHERE played < 30 | sql_create_context |
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... | SELECT prescriptions.route, prescriptions.drug_dose FROM prescriptions WHERE prescriptions.drug = "Miconazole 2% Cream" | mimicsql_data |
CREATE TABLE table_75128 (
"Year" real,
"Chart" text,
"Track" text,
"Peak" real,
"Weeks on Chart" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the total number of weeks for si te vas and peak less than 7 and year less than 2000
| SELECT COUNT("Weeks on Chart") FROM table_75128 WHERE "Track" = 'si te vas' AND "Peak" < '7' AND "Year" < '2000' | wikisql |
CREATE TABLE table_30281 (
"Position" text,
"Number" real,
"Player" text,
"Super League" real,
"Champions League" real,
"Swiss Cup" real,
"Total" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the minimum sum?
| SELECT MIN("Total") FROM table_30281 | wikisql |
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 procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime t... | SELECT SUM(inputevents_cv.amount) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 22517)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.lab... | mimic_iii |
CREATE TABLE table_9225 (
"Name" text,
"Pos." text,
"Height" text,
"Weight" text,
"2012 club" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the name for the 2012 CN Sabadell?
| SELECT "Name" FROM table_9225 WHERE "2012 club" = 'cn sabadell' | wikisql |
CREATE TABLE table_name_68 (
saturday VARCHAR,
name VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Saturday has a Name of confederation?
| SELECT saturday FROM table_name_68 WHERE name = "confederation" | sql_create_context |
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... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "2120" AND prescriptions.route = "IVPCA" | mimicsql_data |
CREATE TABLE club (
clubid number,
clubname text,
clubdesc text,
clublocation text
)
CREATE TABLE member_of_club (
stuid number,
clubid number,
position text
)
CREATE TABLE student (
stuid number,
lname text,
fname text,
age number,
sex text,
major number,
advis... | SELECT t3.lname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Bootup Baltimore" | spider |
CREATE TABLE table_203_409 (
id number,
"rank" number,
"representative" text,
"party" text,
"district" text,
"seniority date" text,
"notes" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- does each congressman have a party listed ?
| SELECT COUNT(*) = 0 FROM table_203_409 WHERE "party" IS NULL | squall |
CREATE TABLE table_203_330 (
id number,
"year of election" number,
"candidates elected" number,
"# of seats available" number,
"# of votes" number,
"% of popular vote" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what year had the most candida... | SELECT "year of election" FROM table_203_330 ORDER BY "candidates elected" DESC LIMIT 1 | squall |
CREATE TABLE jyjgzbb (
BGDH text,
BGRQ time,
CKZFWDX text,
CKZFWSX number,
CKZFWXX number,
JCFF text,
JCRGH text,
JCRXM text,
JCXMMC text,
JCZBDM text,
JCZBJGDL number,
JCZBJGDW text,
JCZBJGDX text,
JCZBMC text,
JLDW text,
JYRQ time,
JYZBLSH text,
... | SELECT zyjzjlb.ZYBMLX, zyjzjlb.ZYZDBM, zyjzjlb.ZYZDMC FROM zyjzjlb WHERE zyjzjlb.JZLSH = '74531070187' | css |
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE icustays (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
first_careunit text,
last_careunit text,
first_wardid number,
last_wardid numbe... | SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT prescriptions.hadm_id FROM prescriptions WHERE prescriptions.drug = 'spironolactone' AND STRFTIME('%y', prescriptions.startdate) = '2105') | mimic_iii |
CREATE TABLE playlisttrack (
playlistid number,
trackid number
)
CREATE TABLE artist (
artistid number,
name text
)
CREATE TABLE invoiceline (
invoicelineid number,
invoiceid number,
trackid number,
unitprice number,
quantity number
)
CREATE TABLE invoice (
invoiceid number,
... | SELECT DISTINCT T1.firstname FROM customer AS T1 JOIN invoice AS T2 ON T1.customerid = T2.customerid WHERE T1.country = "Brazil" | spider |
CREATE TABLE table_17426 (
"Number" real,
"Builder" text,
"Built" text,
"Rebuilt" text,
"Name as rebuilt" text,
"Scrapped/Sold" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the highest number listed?
| SELECT MAX("Number") FROM table_17426 | wikisql |
CREATE TABLE state (
state_code text,
state_name text,
country_name text
)
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 T... | 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, fare, flight, flight_fare 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.... | atis |
CREATE TABLE table_name_91 (
polling_firm VARCHAR,
t_papadopoulos VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which polling firm put T. Papadopoulos at 31%?
| SELECT polling_firm FROM table_name_91 WHERE t_papadopoulos = "31%" | sql_create_context |
CREATE TABLE table_203_517 (
id number,
"#" number,
"date" text,
"visitor" text,
"score" text,
"home" text,
"record" text,
"pts" number
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- is the total score for december 26 the same score as januar... | SELECT (SELECT "score" FROM table_203_517 WHERE "date" = 'december 26') = (SELECT "score" FROM table_203_517 WHERE "date" = 'january 2') | squall |
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number... | SELECT prescriptions.dose_val_rx FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 65962) AND prescriptions.drug = 'd5 1/2ns' AND STRFTIME('%y-%m', prescriptions.startdate) = '2103-05' ORDER BY prescriptions.startdate DESC LIMIT 1 | mimic_iii |
CREATE TABLE table_2508 (
"Year" real,
"Starts" real,
"Wins" real,
"Top 5" real,
"Top 10" real,
"Poles" real,
"Avg. Start" text,
"Avg. Finish" text,
"Winnings" text,
"Position" text,
"Team(s)" text
)
-- Using valid SQLite, answer the following questions for the tables provi... | SELECT MIN("Poles") FROM table_2508 WHERE "Year" = '1996' | wikisql |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREA... | 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 = '007-16517' AND patient.hospitaldischargetime IS NULL)) AND med... | eicu |
CREATE TABLE table_26124171_1 (
team VARCHAR,
series VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many teams were in the series championnat de france formula renault 2.0?
| SELECT team FROM table_26124171_1 WHERE series = "Championnat de France Formula Renault 2.0" | sql_create_context |
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 ... | SELECT (SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 25696 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.l... | mimic_iii |
CREATE TABLE table_24549777_1 (
player VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How man 3-dart averages did gary anderson have?
| SELECT COUNT(3 AS _dart_average) FROM table_24549777_1 WHERE player = "Gary Anderson" | sql_create_context |
CREATE TABLE person_info_hz_info (
RYBH text,
KH number,
KLX number,
YLJGDM number
)
CREATE TABLE jyjgzbb (
BGDH text,
BGRQ time,
CKZFWDX text,
CKZFWSX number,
CKZFWXX number,
JCFF text,
JCRGH text,
JCRXM text,
JCXMMC text,
JCZBDM text,
JCZBJGDL number,
J... | SELECT * FROM hz_info JOIN zyjzjlb JOIN person_info_hz_info JOIN person_info ON hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX AND person_info_hz_info.KH = hz_info.KH AND person_info_hz_info.KLX = hz_info.KLX AND person_info_hz_info.YLJGDM = hz_info.YLJGDM AND person_info_hz_i... | css |
CREATE TABLE table_30120556_1 (
area__acres__ VARCHAR,
civil_parish VARCHAR,
townland VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the area of the civil parish kilworth and townland monadrishane?
| SELECT area__acres__ FROM table_30120556_1 WHERE civil_parish = "Kilworth" AND townland = "Monadrishane" | sql_create_context |
CREATE TABLE table_61421 (
"Name" text,
"Street address" text,
"Years as tallest" text,
"Height ft ( m )" text,
"Floors" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- WHAT IS THE NAME WITH 01.0 10 light street?
| SELECT "Name" FROM table_61421 WHERE "Street address" = '01.0 10 light street' | wikisql |
CREATE TABLE table_61734 (
"Result" text,
"Record" text,
"Opponent" text,
"Method" text,
"Location" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the location when KO is the method, the result is a win, and the record is 2-0?
| SELECT "Location" FROM table_61734 WHERE "Method" = 'ko' AND "Result" = 'win' AND "Record" = '2-0' | wikisql |
CREATE TABLE region (
Region_id int,
Region_code text,
Region_name text
)
CREATE TABLE affected_region (
Region_id int,
Storm_ID int,
Number_city_affected real
)
CREATE TABLE storm (
Storm_ID int,
Name text,
Dates_active text,
Max_speed int,
Damage_millions_USD real,
Nu... | SELECT Name, Number_Deaths FROM storm WHERE Number_Deaths >= 1 ORDER BY Name DESC | nvbench |
CREATE TABLE table_28307 (
"Branding" text,
"Callsign" text,
"Frequency" text,
"Power (kW)" text,
"Location" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What bran is the callsign dytc-fm?
| SELECT "Branding" FROM table_28307 WHERE "Callsign" = 'DYTC-FM' | wikisql |
CREATE TABLE table_2453243_5 (
written_by VARCHAR,
no_in_series VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who write episode number 48 in the series?
| SELECT written_by FROM table_2453243_5 WHERE no_in_series = "48" | sql_create_context |
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE locations (
LOCATION_ID decimal(4,0),
STREET_ADDRESS varchar(40),
POSTAL_CODE varchar(12),
CITY varchar(30),
STATE_PROVINCE varchar(25... | SELECT JOB_ID, COMMISSION_PCT FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY COMMISSION_PCT | nvbench |
CREATE TABLE t_kc21 (
MED_CLINIC_ID text,
OVERALL_CD_ORG text,
OVERALL_CD_PERSON text,
COMP_ID text,
PERSON_ID text,
PERSON_NM text,
IDENTITY_CARD text,
SOC_SRT_CARD text,
PERSON_SEX number,
PERSON_AGE number,
IN_HOSP_DATE time,
OUT_HOSP_DATE time,
DIFF_PLACE_FLG numb... | SELECT COUNT(*) FROM t_kc21 WHERE MED_SER_ORG_NO = '5071294' AND IN_HOSP_DATE BETWEEN '2003-05-09' AND '2008-07-26' AND CLINIC_TYPE = '住院' | css |
CREATE TABLE fgwyjzb (
CLINIC_ID text,
CLINIC_TYPE text,
COMP_ID text,
DATA_ID text,
DIFF_PLACE_FLG number,
FERTILITY_STS number,
FLX_MED_ORG_ID text,
HOSP_LEV number,
HOSP_STS number,
IDENTITY_CARD text,
INPT_AREA_BED text,
INSURED_IDENTITY number,
INSURED_STS text,
... | SELECT gwyjzb.IN_DIAG_DIS_NM, AVG(gwyjzb.PERSON_AGE) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '6149241' GROUP BY gwyjzb.IN_DIAG_DIS_NM UNION SELECT fgwyjzb.IN_DIAG_DIS_NM, AVG(fgwyjzb.PERSON_AGE) FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '6149241' GROUP BY fgwyjzb.IN_DIAG_DIS_NM | css |
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 departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE... | SELECT JOB_ID, AVG(EMPLOYEE_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY AVG(EMPLOYEE_ID) DESC | nvbench |
CREATE TABLE table_4413 (
"Country" text,
"Sales (X1000)" text,
"No. of stores" real,
"Sales area (m\u00b2)" real,
"Sales per area" text,
"Average store size (m\u00b2)" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the smallest sales ar... | SELECT MIN("Sales area (m\u00b2)") FROM table_4413 WHERE "Sales per area" = '€4,094/m²' AND "No. of stores" > '2' | wikisql |
CREATE TABLE table_41561 (
"Branch" text,
"Address" text,
"Neighborhood" text,
"First branch opened" real,
"Current branch opened" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the highest Current Branch Opened, when Neighborhood is W. Port... | SELECT MAX("Current branch opened") FROM table_41561 WHERE "Neighborhood" = 'w. portland park' | wikisql |
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... | SELECT MAX(demographic.age) FROM demographic WHERE demographic.diagnosis = "POSTERIOR COMMUNICATING ANEURYSM/SDA" AND demographic.admityear >= "2203" | mimicsql_data |
CREATE TABLE t_kc24 (
ACCOUNT_DASH_DATE time,
ACCOUNT_DASH_FLG number,
CASH_PAY number,
CIVIL_SUBSIDY number,
CKC102 number,
CLINIC_ID text,
CLINIC_SLT_DATE time,
COMP_ID text,
COM_ACC_PAY number,
COM_PAY number,
DATA_ID text,
ENT_ACC_PAY number,
ENT_PAY number,
F... | SELECT COUNT(t_kc21.IN_DIAG_DIS_CD) FROM t_kc21 WHERE t_kc21.PERSON_ID = '23539348' AND t_kc21.IN_HOSP_DATE BETWEEN '2016-10-28' AND '2017-09-19' | css |
CREATE TABLE zyjzjlb (
CYBQDM text,
CYBQMC text,
CYCWH text,
CYKSDM text,
CYKSMC text,
CYSJ time,
CYZTDM number,
HZXM text,
JZKSDM text,
JZKSMC text,
JZLSH text,
KH text,
KLX number,
MZBMLX number,
MZJZLSH text,
MZZDBM text,
MZZDMC text,
MZZYZDZZBM... | SELECT jyjgzbb.JCZBDM, jyjgzbb.JCZBMC, jyjgzbb.JCZBJGDX, jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW, jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM jyjgzbb WHERE jyjgzbb.BGDH = '09624967019' | css |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.