instruction stringlengths 151 7.46k | output stringlengths 2 4.44k | source stringclasses 26
values |
|---|---|---|
CREATE TABLE table_name_38 (
year INTEGER,
points INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the earliest year when the points were more than 0?
| SELECT MIN(year) FROM table_name_38 WHERE points > 0 | 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 WHERE demographic.diagnosis = "CORONARY ARTERY DISEASE\CORONARY ARTERY BYPASS GRAFT /SDA" AND demographic.dob_year < "2095" | mimicsql_data |
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 lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.diagnosis = "SIGMOID DIVERTICULITIS, COLOVESTICAL FISTULA/SDA" AND prescriptions.route = "NU" | 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 t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM, t_kc22.UNIVALENT FROM t_kc22 WHERE t_kc22.MED_CLINIC_ID IN (SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_NM = '许虹颖' AND t_kc21.MED_SER_ORG_NO = '9484202') ORDER BY t_kc22.UNIVALENT DESC LIMIT 1 | css |
CREATE TABLE SuggestedEdits (
Id number,
PostId number,
CreationDate time,
ApprovalDate time,
RejectionDate time,
OwnerUserId number,
Comment text,
Text text,
Title text,
Tags text,
RevisionGUID other
)
CREATE TABLE PostNotices (
Id number,
PostId number,
PostNot... | SELECT c.Score, c.Id AS "comment_link", c.CreationDate FROM Comments AS c WHERE Text LIKE '%##Word##%' COLLATE SQL_Latin1_General_CP1_CI_AS AND Text LIKE '%##OtherWord##%' COLLATE SQL_Latin1_General_CP1_CI_AS ORDER BY c.CreationDate DESC | sede |
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 MAIN_COND_DES FROM t_kc21 WHERE MED_CLINIC_ID = '00738240365' | css |
CREATE TABLE ta (
campus_job_id int,
student_id int,
location varchar
)
CREATE TABLE course_prerequisite (
pre_course_id int,
course_id int
)
CREATE TABLE jobs (
job_id int,
job_title varchar,
description varchar,
requirement varchar,
city varchar,
state varchar,
countr... | SELECT DISTINCT name, number FROM course WHERE credits = 3 AND department = 'EECS' | advising |
CREATE TABLE table_43181 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What country is phil mickelson from?
| SELECT "Country" FROM table_43181 WHERE "Player" = 'phil mickelson' | wikisql |
CREATE TABLE table_name_76 (
event VARCHAR,
notes VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What Event goes with Notes 53.76?
| SELECT event FROM table_name_76 WHERE notes = "53.76" | sql_create_context |
CREATE TABLE table_2645 (
"Series #" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many series numbers belong to the episode 'Vexation of... | SELECT COUNT("Series #") FROM table_2645 WHERE "Title" = 'Vexation of Spirit' | wikisql |
CREATE TABLE table_name_39 (
athlete VARCHAR,
time VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who had a time of 7:14.64?
| SELECT athlete FROM table_name_39 WHERE time = "7:14.64" | sql_create_context |
CREATE TABLE table_name_37 (
english VARCHAR,
dutch VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which English has Dutch of maken?
| SELECT english FROM table_name_37 WHERE dutch = "maken" | sql_create_context |
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 mzjzjlb.JZLSH FROM person_info JOIN hz_info JOIN mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE person_info.XM = '韦坚秉' AND NOT mzjzjlb.JZLSH IN (SELECT jybgb.JZLSH FROM jybgb WHERE jybgb.BGRQ >= '2001-02-23') | css |
CREATE TABLE table_19824 (
"States" text,
"Fall 05" real,
"Fall 06" real,
"Fall 07" real,
"Fall 08" real,
"Fall 09" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the highest number of students in Fall 09 in the state that had 3821 in F... | SELECT MAX("Fall 09") FROM table_19824 WHERE "Fall 06" = '3821' | wikisql |
CREATE TABLE table_name_40 (
outcome VARCHAR,
date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what is the outcome when the date is 10 october 1994?
| SELECT outcome FROM table_name_40 WHERE date = "10 october 1994" | sql_create_context |
CREATE TABLE hz_info_mzjzjlb (
JZLSH number,
YLJGDM number,
mzjzjlb_id number
)
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 ... | SELECT AVG(jyjgzbb.JCZBJGDL), MIN(jyjgzbb.JCZBJGDL), MAX(jyjgzbb.JCZBJGDL) FROM mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN hz_info_mzjzjlb ON hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH AND hz_info_mzjzjlb.JZLSH = mzjzjl... | css |
CREATE TABLE table_204_874 (
id number,
"year" number,
"winner" text,
"runner-up" text,
"final score" text,
"third" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- which team has the most wins ?
| SELECT "winner" FROM table_204_874 GROUP BY "winner" ORDER BY COUNT(*) DESC LIMIT 1 | squall |
CREATE TABLE table_55316 (
"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.
-- Which Home team plays at the arden street oval V... | SELECT "Home team" FROM table_55316 WHERE "Venue" = 'arden street oval' | wikisql |
CREATE TABLE table_name_39 (
album VARCHAR,
year INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What Album has a Year that's larger than 2001?
| SELECT album FROM table_name_39 WHERE year > 2001 | 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 prescriptions... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.expire_flag = "0" AND prescriptions.formulary_drug_cd = "NS/MBP100I" | mimicsql_data |
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_DIRE_CD text,
MED_DIRE_NM text,... | SELECT t_kc21.MED_SER_ORG_NO FROM t_kc21 WHERE t_kc21.PERSON_NM = '韩清怡' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc21_t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.SOC_SRT_DIRE_CD = '072738-5') | css |
CREATE TABLE table_name_28 (
eliminated VARCHAR,
entered VARCHAR,
wrestler VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Eliminated when there are less than 4 entered and the wrestler was shawn michaels?
| SELECT eliminated FROM table_name_28 WHERE entered < 4 AND wrestler = "shawn michaels" | sql_create_context |
CREATE TABLE table_26669939_1 (
year INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the most recent year?
| SELECT MAX(year) FROM table_26669939_1 | sql_create_context |
CREATE TABLE days (
days_code varchar,
day_name varchar
)
CREATE TABLE ground_service (
city_code text,
airport_code text,
transport_type text,
ground_fare int
)
CREATE TABLE dual_carrier (
main_airline varchar,
low_flight_number int,
high_flight_number int,
dual_airline varcha... | 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 = 'DALLAS' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRA... | atis |
CREATE TABLE table_60767 (
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What date was a friendly match played that ended in a 3-0 score?
| SELECT "Date" FROM table_60767 WHERE "Result" = '3-0' AND "Competition" = 'friendly match' | wikisql |
CREATE TABLE table_41508 (
"Player" text,
"Country" text,
"Year won" real,
"Total" real,
"To par" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Year won for the player with a larger than 4 To par and less the 157 Total?
| SELECT "Year won" FROM table_41508 WHERE "To par" > '4' AND "Total" < '157' | wikisql |
CREATE TABLE table_name_4 (
writer_s_ VARCHAR,
recipient VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who is the writer for Red Rose Chain LTD?
| SELECT writer_s_ FROM table_name_4 WHERE recipient = "red rose chain ltd" | sql_create_context |
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... | SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-1634')) AND medication.routeadmin = 'po' AND DATETIME(medicatio... | eicu |
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name text
)
CREATE TABLE cost (
row_id number,
subject_id number,
hadm_id nu... | SELECT outputevents.charttime FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 13838)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'urin... | mimic_iii |
CREATE TABLE table_name_54 (
wins INTEGER,
year VARCHAR,
class VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Wins have a Year of 1963, and a Class of 50cc?
| SELECT AVG(wins) FROM table_name_54 WHERE year = 1963 AND class = "50cc" | sql_create_context |
CREATE TABLE table_21821014_1 (
chapter VARCHAR,
institution VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the chapter for Illinois Wesleyan?
| SELECT chapter FROM table_21821014_1 WHERE institution = "Illinois Wesleyan" | sql_create_context |
CREATE TABLE routes (
rid number,
dst_apid number,
dst_ap text,
src_apid number,
src_ap text,
alid number,
airline text,
codeshare text
)
CREATE TABLE airlines (
alid number,
name text,
iata text,
icao text,
callsign text,
country text,
active text
)
CREATE ... | SELECT COUNT(DISTINCT city) FROM airports WHERE country = 'Greenland' | spider |
CREATE TABLE table_69239 (
"Team 1" text,
"Agg." text,
"Team 2" text,
"1st leg" text,
"2nd leg" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the agg with a second leg of 0-1?
| SELECT "Agg." FROM table_69239 WHERE "2nd leg" = '0-1' | wikisql |
CREATE TABLE table_34932 (
"Outcome" text,
"Date" text,
"Tournament" text,
"Surface" text,
"Opponent" text,
"Score" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Score had an Opponent of chris evert-lloyd?
| SELECT "Score" FROM table_34932 WHERE "Opponent" = 'chris evert-lloyd' | wikisql |
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE requirement (
requirement_id int,
requirement varchar,
college varchar
)
CREATE TABLE offering_instructor (
offering_instructor_id int,
offering_id int,
instructor_id int
)
CREATE TABLE instructor (
instructo... | SELECT COUNT(DISTINCT instructor.instructor_id) FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.department = 'ORALPATH' AND course.number = 693 AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.o... | advising |
CREATE TABLE table_21839208_4 (
record VARCHAR,
week VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was their record in week 11?
| SELECT record FROM table_21839208_4 WHERE week = 11 | sql_create_context |
CREATE TABLE table_6830 (
"Time" text,
"00:00 AM" text,
"01:00 AM" text,
"02:00 AM" text,
"05:00 AM" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the show on Thursday when the time is 02:00 AM?
| SELECT "02:00 AM" FROM table_6830 WHERE "Time" = 'thursday' | wikisql |
CREATE TABLE journal (
Journal_ID int,
Date text,
Theme text,
Sales int
)
CREATE TABLE editor (
Editor_ID int,
Name text,
Age real
)
CREATE TABLE journal_committee (
Editor_ID int,
Journal_ID int,
Work_Type text
)
-- Using valid SQLite, answer the following questions for the ... | SELECT Name, COUNT(*) FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID = T2.Editor_ID GROUP BY T1.Editor_ID ORDER BY COUNT(*) | nvbench |
CREATE TABLE table_27734286_7 (
high_assists VARCHAR,
game VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who had the high assists for game number 38?
| SELECT high_assists FROM table_27734286_7 WHERE game = 38 | sql_create_context |
CREATE TABLE table_name_51 (
wins INTEGER,
losses INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- For the teams that had less than 1 loss, what was the average number of Wins?
| SELECT AVG(wins) FROM table_name_51 WHERE losses < 1 | sql_create_context |
CREATE TABLE PersonFriend (
name varchar(20),
friend varchar(20),
year INTEGER
)
CREATE TABLE Person (
name varchar(20),
age INTEGER,
city TEXT,
gender TEXT,
job TEXT
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Return a bar chart on what ... | SELECT gender, AVG(age) FROM Person GROUP BY gender ORDER BY gender | nvbench |
CREATE TABLE table_name_5 (
time VARCHAR,
opponent VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the time when his opponent was Rudy Martin?
| SELECT time FROM table_name_5 WHERE opponent = "rudy martin" | sql_create_context |
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... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "PNEUMONIA" AND demographic.age < "85" | mimicsql_data |
CREATE TABLE table_5440 (
"Driver" text,
"Seasons" text,
"Entries" real,
"3rd places" real,
"Percentage" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the least amount of entries that has 9.31% as a percentage with a 3rd place larger than 2... | SELECT MIN("Entries") FROM table_5440 WHERE "Percentage" = '9.31%' AND "3rd places" > '23' | wikisql |
CREATE TABLE Customer_Payments (
customer_id INTEGER,
datetime_payment DATETIME,
payment_method_code VARCHAR(10),
amount_payment DOUBLE
)
CREATE TABLE Staff (
staff_id INTEGER,
staff_address_id INTEGER,
nickname VARCHAR(80),
first_name VARCHAR(80),
middle_name VARCHAR(80),
last_... | SELECT payment_method_code, COUNT(*) FROM Customer_Payments GROUP BY payment_method_code ORDER BY COUNT(*) | nvbench |
CREATE TABLE table_name_93 (
location VARCHAR,
previous_champion_s_ VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which location had previous champions of Mike Webb and Nick Fahrenheit?
| SELECT location FROM table_name_93 WHERE previous_champion_s_ = "mike webb and nick fahrenheit" | sql_create_context |
CREATE TABLE table_24658 (
"Week" real,
"Date" text,
"Opponent" text,
"Location" text,
"Final Score" text,
"Attendance" real,
"Record" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was their record in week 11?
| SELECT "Record" FROM table_24658 WHERE "Week" = '11' | wikisql |
CREATE TABLE table_204_836 (
id number,
"#" number,
"date" text,
"opponent" text,
"score" text,
"result" text,
"competition" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- of the ten games in which rowaihi scored goals for the saudi team , h... | SELECT COUNT(*) FROM table_204_836 WHERE "score" - "score" >= 3 | squall |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
ic... | SELECT t3.labname FROM (SELECT t2.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'neck tumor - thyr... | eicu |
CREATE TABLE table_50380 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was Phil Mickelson's score to par?
| SELECT "To par" FROM table_50380 WHERE "Player" = 'phil mickelson' | wikisql |
CREATE TABLE table_name_10 (
Id VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the highest 2009 value with a 2006 value smaller than 280.4, a 2007 less than 2.2, and a 2011 less than 3.5?
| SELECT MAX(2009) FROM table_name_10 WHERE 2006 < 280.4 AND 2007 < 2.2 AND 2010 < 3.5 | sql_create_context |
CREATE TABLE table_204_184 (
id number,
"#" number,
"title" text,
"producer(s)" text,
"featured guest(s)" text,
"length" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- which is the only track under two minutes ?
| SELECT "title" FROM table_204_184 WHERE "length" < 2 | squall |
CREATE TABLE railway_manage (
Railway_ID int,
Manager_ID int,
From_Year text
)
CREATE TABLE train (
Train_ID int,
Train_Num text,
Name text,
From text,
Arrival text,
Railway_ID int
)
CREATE TABLE manager (
Manager_ID int,
Name text,
Country text,
Working_year_starts... | SELECT Builder, COUNT(*) FROM railway GROUP BY Builder ORDER BY Builder DESC | nvbench |
CREATE TABLE table_13312864_1 (
player VARCHAR,
weight VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many players weight 95?
| SELECT COUNT(player) FROM table_13312864_1 WHERE weight = 95 | sql_create_context |
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 demographic ... | 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.icd9_code = "45821" AND lab.fluid = "Urine" | mimicsql_data |
CREATE TABLE bdmzjzjlb (
HXPLC number,
HZXM text,
JLSJ time,
JZJSSJ time,
JZKSBM text,
JZKSMC text,
JZKSRQ time,
JZLSH number,
JZZDBM text,
JZZDSM text,
JZZTDM number,
JZZTMC text,
KH text,
KLX number,
MJZH text,
ML number,
MZZYZDZZBM text,
MZZYZDZ... | SELECT COUNT(*) FROM wdmzjzjlb WHERE wdmzjzjlb.YLJGDM = '6851618' AND wdmzjzjlb.JZKSRQ BETWEEN '2015-07-27' AND '2016-11-04' AND wdmzjzjlb.TXBZ > 0 UNION SELECT COUNT(*) FROM bdmzjzjlb WHERE bdmzjzjlb.YLJGDM = '6851618' AND bdmzjzjlb.JZKSRQ BETWEEN '2015-07-27' AND '2016-11-04' AND bdmzjzjlb.TXBZ > 0 | css |
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,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "86" AND procedures.short_title = "Infusion of vasopressor" | mimicsql_data |
CREATE TABLE PostHistory (
Id number,
PostHistoryTypeId number,
PostId number,
RevisionGUID other,
CreationDate time,
UserId number,
UserDisplayName text,
Comment text,
Text text,
ContentLicense text
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Descr... | SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation, Location FROM Users WHERE UPPER(Location) LIKE '%LOS ANGELES%' AND UPPER(Location) LIKE '%CA' ORDER BY Reputation DESC | sede |
CREATE TABLE table_41883 (
"Episode number" real,
"Title" text,
"Original airing on Channel 4" text,
"Time of airing on Channel 4" text,
"Original airing on E4" text,
"Time of airing on E4" text,
"Position in Channel 4 and Channel 4+1's ratings" text,
"Position in E4 and E4+1's ratings" ... | SELECT "Time of airing on Channel 4" FROM table_41883 WHERE "Episode number" > '106' AND "Title" = 'marry me a little' | wikisql |
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_tit... | SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 6580 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1)) AND cha... | mimic_iii |
CREATE TABLE table_7420 (
"Home team" text,
"Away team" text,
"Match score" text,
"\"Pick The Winners\" score" text,
"FootyTAB winner" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Home team when the away team was Manly?
| SELECT "Home team" FROM table_7420 WHERE "Away team" = 'manly' | wikisql |
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 TABLE record (
ID int,
Result text,
Swimmer_ID int,
Event_ID int
)
... | SELECT Nationality, AVG(ID) FROM swimmer GROUP BY Nationality ORDER BY Nationality DESC | nvbench |
CREATE TABLE t_kc24 (
MED_SAFE_PAY_ID text,
OVERALL_CD_ORG text,
OVERALL_CD_PERSON text,
MED_CLINIC_ID text,
REF_SLT_FLG number,
CLINIC_SLT_DATE time,
COMP_ID text,
PERSON_ID text,
FLX_MED_ORG_ID text,
INSU_TYPE text,
MED_AMOUT number,
PER_ACC_PAY number,
OVE_PAY numb... | SELECT FLX_MED_ORG_ID FROM t_kc21 WHERE MED_CLINIC_ID = '12867892792' | css |
CREATE TABLE table_54343 (
"Dismissals" text,
"Player" text,
"Versus" text,
"Venue" text,
"Date" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Versus with a Player with ko otieno, with Venue with bloemfontein?
| SELECT "Versus" FROM table_54343 WHERE "Player" = 'ko otieno' AND "Venue" = 'bloemfontein' | wikisql |
CREATE TABLE table_69459 (
"Rider" text,
"Year" real,
"Final Position - Giro" real,
"Final Position - Tour" real,
"Final Position - Vuelta" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the earliest year of Valdimir Poelnikov, who has a fin... | SELECT MIN("Year") FROM table_69459 WHERE "Final Position - Tour" > '72' AND "Final Position - Vuelta" < '77' AND "Final Position - Giro" < '57' AND "Rider" = 'valdimir poelnikov' | wikisql |
CREATE TABLE table_77807 (
"Rank" real,
"Constituency" text,
"Winning party 2007" text,
"Swing to gain" real,
"LD's place 2007" text,
"Result" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- how many times is the constituency edinburgh northern a... | SELECT COUNT("Swing to gain") FROM table_77807 WHERE "Constituency" = 'edinburgh northern and leith' | wikisql |
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 t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_ID = '29216620' AND NOT t_kc22.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT >= 3853.34) | css |
CREATE TABLE table_27789 (
"Stage" real,
"Winner" text,
"General Classification" text,
"Mountains Classification" text,
"Sprint Classification" text,
"Young Rider Classification" text,
"Team Classification" text,
"Aggressive Rider" text
)
-- Using valid SQLite, answer the following que... | SELECT "Aggressive Rider" FROM table_27789 WHERE "Sprint Classification" = 'André Greipel' AND "Mountains Classification" = 'Timothy Roe' | wikisql |
CREATE TABLE table_62540 (
"Year" text,
"Arizona" text,
"California" text,
"Colorado" text,
"Nevada" text,
"New Mexico" text,
"Oklahoma" text,
"Texas" text,
"Utah" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What's the value for a... | SELECT "Arizona" FROM table_62540 WHERE "Colorado" = 'nixon' AND "Nevada" = 'nixon' AND "Texas" = 'humphrey' | wikisql |
CREATE TABLE customers (
customer_id VARCHAR,
customer_name VARCHAR
)
CREATE TABLE available_policies (
policy_type_code VARCHAR,
policy_id VARCHAR
)
CREATE TABLE customers_policies (
customer_id VARCHAR,
policy_id VARCHAR
)
-- Using valid SQLite, answer the following questions for the table... | SELECT DISTINCT t3.policy_type_code FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id JOIN available_policies AS t3 ON t2.policy_id = t3.policy_id WHERE t1.customer_name = (SELECT t1.customer_name FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id G... | sql_create_context |
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 (
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.marital_status = "WIDOWED" AND prescriptions.route = "ORAL" | mimicsql_data |
CREATE TABLE table_name_38 (
record VARCHAR,
time VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- The match that lasted 2:43 has what record?
| SELECT record FROM table_name_38 WHERE time = "2:43" | sql_create_context |
CREATE TABLE table_58547 (
"Name" text,
"Country" text,
"Type" text,
"Moving from" text,
"Transfer window" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which country is Dyer from?
| SELECT "Country" FROM table_58547 WHERE "Name" = 'dyer' | wikisql |
CREATE TABLE table_57335 (
"Team" text,
"Outgoing manager" text,
"Manner of departure" text,
"Date of vacancy" text,
"Replaced by" text,
"Date of appointment" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the manner of depature when th... | SELECT "Manner of departure" FROM table_57335 WHERE "Date of appointment" = '27 december 2007' | wikisql |
CREATE TABLE Tags (
Id number,
TagName text,
Count number,
ExcerptPostId number,
WikiPostId number
)
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
VoteTypeId number,
CreationDate time
)
CREATE TABLE VoteTypes (
Id number,
Name text
)
CREATE... | SELECT COUNT(*) AS total_users FROM Users | sede |
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9cod... | SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'thera... | eicu |
CREATE TABLE settlements (
settlement_id number,
claim_id number,
effective_date time,
settlement_amount number
)
CREATE TABLE first_notification_of_loss (
fnol_id number,
customer_id number,
policy_id number,
service_id number
)
CREATE TABLE customers (
customer_id number,
cus... | SELECT COUNT(*) FROM services | spider |
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE labevents (
row_id number,
subject_id number,
... | SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t1.itemid FROM (SELECT labevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM labevents WHERE DATETIME(labevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY labevents.itemid) AS t1... | mimic_iii |
CREATE TABLE table_42608 (
"Condition" text,
"Prothrombin time" text,
"Partial thromboplastin time" text,
"Bleeding time" text,
"Platelet count" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Platelet count has a Partial thromboplastin time of... | SELECT "Platelet count" FROM table_42608 WHERE "Partial thromboplastin time" = 'prolonged or unaffected' | 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 lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "68" AND prescriptions.drug = "Vancomycin" | mimicsql_data |
CREATE TABLE table_name_10 (
game INTEGER,
march VARCHAR,
score VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Game has a March smaller than 12, and a Score of 10 1?
| SELECT MIN(game) FROM table_name_10 WHERE march < 12 AND score = "10–1" | sql_create_context |
CREATE TABLE table_name_35 (
name VARCHAR,
total_points VARCHAR,
rank VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who is at rank 13 with 23 total points?
| SELECT name FROM table_name_35 WHERE total_points = "23" AND rank = "13" | sql_create_context |
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 SUM(t_kc22.AMOUNT) FROM gwyjzb JOIN t_kc22 ON gwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gwyjzb.PERSON_ID = '99930472' AND gwyjzb.CLINIC_TYPE = '门诊' AND t_kc22.STA_DATE BETWEEN '2008-01-27' AND '2008-12-15' AND t_kc22.MED_INV_ITEM_TYPE = '手术费' UNION SELECT SUM(t_kc22.AMOUNT) FROM fgwyjzb JOIN t_kc22 ON fg... | css |
CREATE TABLE gwyjzb (
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 SUM(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.MED_CLINIC_ID IN (SELECT gwyjzb.MED_CLINIC_ID FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '3006208' AND gwyjzb.MED_ORG_DEPT_NM = '小儿肛肠外科' UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '3006208' AND fgwyjzb.MED_ORG_DEPT_NM = '小儿肛肠外科') A... | css |
CREATE TABLE table_23916272_6 (
written_by VARCHAR,
original_air_date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was the writer for the episode originally airing on March 1, 2004?
| SELECT written_by FROM table_23916272_6 WHERE original_air_date = "March 1, 2004" | sql_create_context |
CREATE TABLE table_43031 (
"Maximum Ceiling Temperature" text,
"Temperature Rating" text,
"Temperature Classification" text,
"Color Code (with Fusible Link)" text,
"Glass Bulb Color" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the color c... | SELECT "Color Code (with Fusible Link)" FROM table_43031 WHERE "Temperature Classification" = 'ordinary' | wikisql |
CREATE TABLE table_54482 (
"Player" text,
"Nationality" text,
"Position" text,
"Years for Jazz" text,
"School/Club Team" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What Utah Jazz player played Center?
| SELECT "Player" FROM table_54482 WHERE "Position" = 'center' | wikisql |
CREATE TABLE student_record (
student_id int,
course_id int,
semester int,
grade varchar,
how varchar,
transfer_source varchar,
earn_credit varchar,
repeat_term varchar,
test_id varchar
)
CREATE TABLE course_tags_count (
course_id int,
clear_grading int,
pop_quiz int,
... | SELECT DISTINCT semester.semester, semester.year FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number = 501 AND course_offering.semester = semester.semester_id AND semester.semester_id > (SELECT SEMESTERalias1.semester_id FROM semeste... | advising |
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
)
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "1846" AND prescriptions.formulary_drug_cd = "CEFE1I" | mimicsql_data |
CREATE TABLE table_name_87 (
Id VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the 2003 value for the 2008 grand slam tournaments?
| SELECT 2003 FROM table_name_87 WHERE 2008 = "grand slam tournaments" | sql_create_context |
CREATE TABLE table_65542 (
"Rank" real,
"Rowers" text,
"Country" text,
"Time" text,
"Notes" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What's the rank if the time was 5:54.57 and FB in notes?
| SELECT "Rank" FROM table_65542 WHERE "Notes" = 'fb' AND "Time" = '5:54.57' | wikisql |
CREATE TABLE student (
student_id int,
lastname varchar,
firstname varchar,
program_id int,
declare_major varchar,
total_credit int,
total_gpa float,
entered_as varchar,
admit_term int,
predicted_graduation_semester int,
degree varchar,
minor varchar,
internship varch... | SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN area ON course.course_id = area.course_id INNER JOIN program_course ON program_course.course_id = course.course_id WHERE (area.area LIKE '%Russian Jewish Culture%' OR course.description LIKE '%Russian Jewish Culture%' OR course.name LI... | advising |
CREATE TABLE Subjects (
subject_id INTEGER,
subject_name VARCHAR(120)
)
CREATE TABLE Students (
student_id INTEGER,
date_of_registration DATETIME,
date_of_latest_logon DATETIME,
login_name VARCHAR(40),
password VARCHAR(10),
personal_name VARCHAR(40),
middle_name VARCHAR(40),
fam... | 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) DESC | nvbench |
CREATE TABLE university (
School_ID int,
School text,
Location text,
Founded real,
Affiliation text,
Enrollment real,
Nickname text,
Primary_conference text
)
CREATE TABLE basketball_match (
Team_ID int,
School_ID int,
Team_Name text,
ACC_Regular_Season text,
ACC_Per... | SELECT ACC_Regular_Season, School_ID FROM basketball_match ORDER BY School_ID DESC | nvbench |
CREATE TABLE table_29071 (
"Date" text,
"Time" text,
"Visiting team" text,
"Home team" text,
"Site" text,
"Broadcast" text,
"Result" text,
"Attendance" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many times was the site wallace wa... | SELECT COUNT("Attendance") FROM table_29071 WHERE "Site" = 'Wallace Wade Stadium • Durham, NC' | wikisql |
CREATE TABLE table_11677691_12 (
player VARCHAR,
school VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- who are all the players for st. thomas aquinas high school
| SELECT player FROM table_11677691_12 WHERE school = "St. Thomas Aquinas High school" | sql_create_context |
CREATE TABLE table_60745 (
"Player" text,
"Country" text,
"Year(s) won" text,
"Total" real,
"To par" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the total To Par for the winner in 1995?
| SELECT COUNT("To par") FROM table_60745 WHERE "Year(s) won" = '1995' | wikisql |
CREATE TABLE university (
School_ID int,
School text,
Location text,
Founded real,
Affiliation text,
Enrollment real,
Nickname text,
Primary_conference text
)
CREATE TABLE basketball_match (
Team_ID int,
School_ID int,
Team_Name text,
ACC_Regular_Season text,
ACC_Per... | SELECT All_Neutral, School_ID FROM basketball_match ORDER BY School_ID DESC | nvbench |
CREATE TABLE table_79445 (
"Tie no" text,
"Home team" text,
"Score" text,
"Away team" text,
"Date" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What's the score when the tie number was replay?
| SELECT "Score" FROM table_79445 WHERE "Tie no" = 'replay' | wikisql |
CREATE TABLE table_23728 (
"Date" text,
"Presenter" text,
"Guest 1" text,
"Guest 2" text,
"Guest 3" text,
"Guest 4" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the date of the episode in which the presenter is Johnny Vaughan?
| SELECT "Date" FROM table_23728 WHERE "Presenter" = 'Johnny Vaughan' | wikisql |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.