context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE medication (
me... | how many hours have passed since patient 032-21820 first received his/her procedure during their current hospital visit? | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '032-21820... | eicu |
CREATE TABLE table_name_84 (
attendance VARCHAR,
tie_no VARCHAR
) | On what day was the attendance that had a Tie value of 40? | SELECT attendance FROM table_name_84 WHERE tie_no = "40" | sql_create_context |
CREATE TABLE table_44671 (
"Date" text,
"Time" text,
"Home" text,
"Geust" text,
"Result" text
) | What is Geust, when Result is 0:9? | SELECT "Geust" FROM table_44671 WHERE "Result" = '0:9' | wikisql |
CREATE TABLE table_name_10 (
goal VARCHAR,
venue VARCHAR,
date VARCHAR
) | At the venue of panama city, on 11 Febrero 2006, how many goals were scored? | SELECT COUNT(goal) FROM table_name_10 WHERE venue = "panama city" AND date = "11 febrero 2006" | sql_create_context |
CREATE TABLE table_20868 (
"Player" text,
"No." real,
"Nationality" text,
"Position" text,
"Years for Grizzlies" text,
"School/Club Team" text
) | What players attended missouri? | SELECT "Player" FROM table_20868 WHERE "School/Club Team" = 'Missouri' | wikisql |
CREATE TABLE Documents_with_expenses (
Id VARCHAR
) | How many documents have expenses? | SELECT COUNT(*) FROM Documents_with_expenses | sql_create_context |
CREATE TABLE table_204_468 (
id number,
"pos" number,
"no" number,
"driver" text,
"team" text,
"laps" number,
"time/retired" text,
"grid" number,
"points" number
) | alex zanardi came in first place , what is his number ? | SELECT "no" FROM table_204_468 WHERE "pos" = 1 | squall |
CREATE TABLE table_11680175_1 (
vehlefanz VARCHAR,
bärenklau VARCHAR
) | What was the number for Vehlefanz where B renklau is 1.288? | SELECT vehlefanz FROM table_11680175_1 WHERE bärenklau = "1.288" | sql_create_context |
CREATE TABLE table_name_92 (
director_s_ VARCHAR,
film VARCHAR
) | Name the director of alt i alt | SELECT director_s_ FROM table_name_92 WHERE film = "alt i alt" | sql_create_context |
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,
... | how many patients whose gender is m and admission year is less than 2138? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "M" AND demographic.admityear < "2138" | mimicsql_data |
CREATE TABLE hall_of_fame (
player_id text,
yearid number,
votedby text,
ballots text,
needed text,
votes text,
inducted text,
category text,
needed_note text
)
CREATE TABLE player_award (
player_id text,
award_id text,
year number,
league_id text,
tie text,
... | Which Country are most baseball players from? | SELECT birth_country FROM player GROUP BY birth_country ORDER BY COUNT(*) DESC LIMIT 1 | thehistoryofbaseball |
CREATE TABLE Movie (
mID int,
title text,
year int,
director text
)
CREATE TABLE Rating (
rID int,
mID int,
stars int,
ratingDate date
)
CREATE TABLE Reviewer (
rID int,
name text
) | Please visualize a bar chart, that the X-axis is the director and the Y-axis is thier corresponding lowest rating among all movies, display Y in desc order. | SELECT director, MIN(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY director ORDER BY MIN(T1.stars) DESC | nvbench |
CREATE TABLE table_name_24 (
rank VARCHAR,
total VARCHAR,
gold VARCHAR
) | Which Rank has a Total larger than 9, and a Gold larger than 6? | SELECT rank FROM table_name_24 WHERE total > 9 AND gold > 6 | sql_create_context |
CREATE TABLE table_35906 (
"Date" text,
"Tournament" text,
"Winning score" text,
"Margin of victory" text,
"Runner(s)-up" text
) | On what Date was the Winning score 8 (69-72-70-69=280)? | SELECT "Date" FROM table_35906 WHERE "Winning score" = '–8 (69-72-70-69=280)' | wikisql |
CREATE TABLE table_51659 (
"Ceremony" text,
"Award" text,
"Category" text,
"Nominee" text,
"Outcome" text
) | In which ceremony was Harnam Singh Rawail nominated for an award? | SELECT "Ceremony" FROM table_51659 WHERE "Nominee" = 'harnam singh rawail' | wikisql |
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAddress text
)
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId n... | SELECT * FROM votes WHERE votetypeid = 7 AND userid <> NULL;. | SELECT * FROM Votes WHERE VoteTypeId = 7 AND UserId > 0 | sede |
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
)
... | count the number of patients whose ethnicity is black/cape verdean? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" | mimicsql_data |
CREATE TABLE book (
Book_ID int,
Title text,
Issues real,
Writer text
)
CREATE TABLE publication (
Publication_ID int,
Book_ID int,
Publisher text,
Publication_Date text,
Price real
) | Show different publishers together with the number of publications they have in a bar chart. | SELECT Publisher, COUNT(*) FROM publication GROUP BY Publisher | nvbench |
CREATE TABLE personfriend (
name text,
friend text,
year number
)
CREATE TABLE person (
name text,
age number,
city text,
gender text,
job text
) | Find the name of the person who has friends with age above 40 and under age 30? | SELECT T1.name FROM person AS T1 JOIN personfriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM person WHERE age > 40) INTERSECT SELECT T1.name FROM person AS T1 JOIN personfriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM person WHERE age < 30) | spider |
CREATE TABLE table_name_36 (
height VARCHAR,
hometown VARCHAR
) | What is the height of the player from Elizabeth, NJ? | SELECT height FROM table_name_36 WHERE hometown = "elizabeth, nj" | 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... | 从04年9月12日至2008年2月3日之内患者55507351被开出的所有药品的编码、名称、数量、单价、金额分别是多些啊? | SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM, t_kc22.QTY, t_kc22.UNIVALENT, t_kc22.AMOUNT FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_ID = '55507351' AND t_kc22.t_kc21_IN_HOSP_DATE BETWEEN '2004-09-12' AND '2008-02-03' | css |
CREATE TABLE table_652 (
"No. in series" real,
"No. in season" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"U.S. viewers (millions)" text
) | When was the episode directed by Carey Meyer aired for the first time? | SELECT "Original air date" FROM table_652 WHERE "Directed by" = 'Carey Meyer' | wikisql |
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE PostFeedback (
Id nu... | Most popular StackOverflow tags in April 2020. | SELECT num.TagName AS Tag, ROW_NUMBER() OVER (ORDER BY rate.Rate DESC) AS PeriodRank, ROW_NUMBER() OVER (ORDER BY num.Num DESC) AS TotalRank, rate.Rate AS QuestionsInPeriod, num.Num AS QuestionsTotal FROM (SELECT COUNT(PostId) AS Rate, TagName FROM Tags, PostTags, Posts WHERE Tags.Id = PostTags.TagId AND Posts.Id = Pos... | sede |
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 PendingFlags (
Id number,
FlagTypeId number,
Po... | Trello vs Jira (# of Question Views per Month). | SELECT DATEADD(mm, (YEAR(Posts.CreationDate) - 1900) * 12 + MONTH(Posts.CreationDate) - 1, 0) AS Month, Tags.TagName, SUM(Posts.ViewCount) AS Views FROM Tags LEFT JOIN PostTags ON PostTags.TagId = Tags.Id LEFT JOIN Posts ON Posts.Id = PostTags.PostId LEFT JOIN PostTypes ON PostTypes.Id = Posts.PostTypeId WHERE Tags.Tag... | sede |
CREATE TABLE table_name_50 (
player VARCHAR,
score VARCHAR
) | What player scored 68-66=134? | SELECT player FROM table_name_50 WHERE score = 68 - 66 = 134 | sql_create_context |
CREATE TABLE Accounts (
account_id INTEGER,
customer_id INTEGER,
date_account_opened DATETIME,
account_name VARCHAR(50),
other_account_details VARCHAR(255)
)
CREATE TABLE Financial_Transactions (
transaction_id INTEGER,
account_id INTEGER,
invoice_number INTEGER,
transaction_type VA... | Stacked bar chart of the number of date account opened for with each other_account_details in each date account opened, and display by the the number of date account opened from low to high please. | SELECT date_account_opened, COUNT(date_account_opened) FROM Accounts GROUP BY other_account_details ORDER BY COUNT(date_account_opened) | nvbench |
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 ... | give me the number of patients whose primary disease is bowel obstruction and lab test fluid is blood? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "BOWEL OBSTRUCTION" AND lab.fluid = "Blood" | mimicsql_data |
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 icustays (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
first_careunit... | what's patient 51675's maximum value of monocytes until 40 months ago? | SELECT MAX(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 51675) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'monocytes') AND DATETIME(labevents.charttime) <= DATETIME(CURRENT_TIME(), '... | mimic_iii |
CREATE TABLE table_66545 (
"Draw" real,
"Song" text,
"Jury" real,
"Televote" real,
"Total" real,
"Place" text
) | What sum of draw had more than 22 in Jury and a Televote of 130? | SELECT SUM("Draw") FROM table_66545 WHERE "Jury" > '22' AND "Televote" = '130' | wikisql |
CREATE TABLE table_40649 (
"Rank" real,
"Name" text,
"Years" text,
"Matches" real,
"Goals" real
) | How many ranks had 205 matches? | SELECT COUNT("Rank") FROM table_40649 WHERE "Matches" = '205' | wikisql |
CREATE TABLE table_204_517 (
id number,
"name" text,
"date of birth" text,
"club" text,
"division" text,
"appointed" text,
"time as manager" text
) | how long has frank defays served as manager ? | SELECT "time as manager" FROM table_204_517 WHERE "name" = 'frank defays' | squall |
CREATE TABLE table_name_2 (
country VARCHAR,
place VARCHAR
) | Name the country that has m ntt | SELECT country FROM table_name_2 WHERE place = "mänttä" | sql_create_context |
CREATE TABLE table_204_905 (
id number,
"team" text,
"wins" number,
"losses" number,
"win %" number,
"gb" number
) | which team has the least win percentage ? | SELECT "team" FROM table_204_905 ORDER BY "win %" LIMIT 1 | squall |
CREATE TABLE table_52280 (
"Years" text,
"Winners" text,
"Runners-Up" text,
"Score" text,
"Third" text
) | Who was the winner in the competition in which Lyn took third place and Lillestr m was the runner-up? | SELECT "Winners" FROM table_52280 WHERE "Runners-Up" = 'lillestrøm' AND "Third" = 'lyn' | wikisql |
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 (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
... | what is the number of patients whose insurance is private and admission year is less than 2168? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Private" AND demographic.admityear < "2168" | mimicsql_data |
CREATE TABLE table_name_38 (
kono INTEGER,
bonthe INTEGER
) | What is the sum of the kono with a bonthe greater than 21,238? | SELECT SUM(kono) FROM table_name_38 WHERE bonthe > 21 OFFSET 238 | sql_create_context |
CREATE TABLE table_name_70 (
fips_code INTEGER,
area VARCHAR,
population__2010_ VARCHAR
) | What is the FIPS code for the municipality that has an area of 114.76 sq mi (297.23 sq km) and had a 2010 population of less than 166,327? | SELECT AVG(fips_code) FROM table_name_70 WHERE area = "114.76 sq mi (297.23 sq km)" AND population__2010_ < 166 OFFSET 327 | sql_create_context |
CREATE TABLE table_21963 (
"Voivodeship after 1569" text,
"Capital" text,
"Year established" real,
"Number of powiats" text,
"Area (km\u00b2) in 1590 (Lithuanian) Category:Articles with Lithuanian-language external links" real
) | What is the latest year established that had 5 powiats? | SELECT MAX("Year established") FROM table_21963 WHERE "Number of powiats" = '5 powiats' | wikisql |
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE intakeoutput (
intakeoutpu... | what is the daily minimum amount of pt - inr patient 016-5834 has since 2102? | SELECT MIN(lab.labresult) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-5834')) AND lab.labname = 'pt - inr' AND STRFTIME('%y', lab.labresulttime) >= ... | eicu |
CREATE TABLE mzjybgb (
BBCJBW text,
BBDM text,
BBMC text,
BBZT number,
BGDH number,
BGJGDM text,
BGJGMC text,
BGRGH text,
BGRQ time,
BGRXM text,
BGSJ time,
CJRQ time,
JSBBRQSJ time,
JSBBSJ time,
JYBBH text,
JYJGMC text,
JYJSGH text,
JYJSQM text,
... | 08218858这个病人在二零年十月十七日以后有哪些住院就诊的检验报告单?看看这些住院就诊的流水编码 | SELECT zyjzjlb.JZLSH FROM hz_info JOIN zyjzjlb ON hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX WHERE hz_info.RYBH = '08218858' AND NOT zyjzjlb.JZLSH IN (SELECT zyjybgb.JZLSH FROM zyjybgb WHERE zyjybgb.BGRQ <= '2020-10-17' UNION SELECT mzjybgb.JZLSH FROM mzjybgb WHERE mzjybgb... | css |
CREATE TABLE table_name_36 (
project_name VARCHAR,
country VARCHAR
) | What is the Project Name with a Country that is opec? | SELECT project_name FROM table_name_36 WHERE country = "opec" | sql_create_context |
CREATE TABLE table_54045 (
"KK - 1" text,
"KK - 2" text,
"KK - 3" text,
"KK - 4" text,
"KK - 5" text,
"KK - 6" text,
"KK - 7" text
) | What is KK - 5 if KK - 1 is 1,067? | SELECT "KK - 5" FROM table_54045 WHERE "KK - 1" = '1,067' | wikisql |
CREATE TABLE table_72548 (
"PowerShell (Cmdlet)" text,
"PowerShell (Alias)" text,
"CMD.EXE / COMMAND.COM" text,
"Unix shell" text,
"Description" text
) | If Powershell (alias) is cpi, copy, cp, what are all corresponding descriptions. | SELECT "Description" FROM table_72548 WHERE "PowerShell (Alias)" = 'cpi, copy, cp' | wikisql |
CREATE TABLE jybgb (
BBCJBW text,
BBDM text,
BBMC text,
BBZT number,
BGDH text,
BGJGDM text,
BGJGMC text,
BGRGH text,
BGRQ time,
BGRXM text,
BGSJ time,
CJRQ time,
JSBBRQSJ time,
JSBBSJ time,
JYBBH text,
JYJGMC text,
JYJSGH text,
JYJSQM text,
JY... | 从06年1月27日至2008年10月10日内病患11575009的所有检验结果指标记录中的仪器编号都是啥?名称都叫什么? | SELECT jyjgzbb.YQBH, jyjgzbb.YQMC FROM hz_info JOIN txmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX AND txmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND txmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH ... | css |
CREATE TABLE table_25950 (
"Game" real,
"Date" text,
"Opponent" text,
"Score" text,
"Location" text,
"Attendance" real,
"Record" text,
"Points" real
) | How many different scores are there for the game with 10-3-4 record? | SELECT COUNT("Score") FROM table_25950 WHERE "Record" = '10-3-4' | wikisql |
CREATE TABLE table_29983 (
"Pick" real,
"Player" text,
"Position" text,
"Nationality" text,
"NHL team" text,
"College/junior/club team" text
) | which part on the team does rick schuhwerk play | SELECT "Position" FROM table_29983 WHERE "Player" = 'Rick Schuhwerk' | wikisql |
CREATE TABLE table_28382 (
"No. in series" real,
"No. in season" real,
"Title" text,
"Directed by" text,
"Written by:" text,
"Original air date" text
) | How many numbers in series were for the number in season of 8? | SELECT COUNT("No. in series") FROM table_28382 WHERE "No. in season" = '8' | wikisql |
CREATE TABLE table_70209 (
"Grand Prix" text,
"Pole position" text,
"Fastest lap" text,
"Winning driver" text,
"Winning constructor" text,
"Report" text
) | Name the winning constructor for when the fastest lap was mark webber at the malaysian grand prix | SELECT "Winning constructor" FROM table_70209 WHERE "Fastest lap" = 'mark webber' AND "Grand Prix" = 'malaysian grand prix' | wikisql |
CREATE TABLE table_1566848_7 (
interview_subject VARCHAR,
date VARCHAR
) | Who was the interview subject in the 2-86 issue? | SELECT interview_subject FROM table_1566848_7 WHERE date = "2-86" | 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_DIRE_CD text,
MED_DIRE_NM text,... | 这位谢红香的患者在13年1月13日到14年5月21日期间,在医院看病时一共检查了多少次 | SELECT COUNT(*) FROM t_kc21 JOIN t_kc22 JOIN t_kc21_t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc22.MED_CLINIC_ID AND t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID WHERE t_kc21.PERSON_NM = '谢红香' AND t_kc22.STA_DATE BETWEEN '2013-01-13' AND '2014-05-21' AND t_kc22.MED_INV_ITEM_TYPE = '检查费' | css |
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE microbiologyeve... | what is the maximum amount of hospital cost which includes a iron testing lab test until 2 years ago? | SELECT MAX(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'iron')) AND DATETIME(cost.chargetime) <= DATETIME(CURRENT_TIME(), '-2 year') GROUP BY cost.hadm_id) A... | mimic_iii |
CREATE TABLE table_58360 (
"Rank" real,
"Name" text,
"Nation" text,
"SP+FS" real,
"Points" real,
"Places" real
) | what is the places when for the soviet union with a rank more than 11? | SELECT SUM("Places") FROM table_58360 WHERE "Nation" = 'soviet union' AND "Rank" > '11' | wikisql |
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... | 在10年3月5日到13年8月3日期间,韩芳洲这位参保人门诊检查费有多少元 | SELECT SUM(t_kc22.AMOUNT) FROM t_kc21 JOIN t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE t_kc21.PERSON_NM = '韩芳洲' AND t_kc21.CLINIC_TYPE = '门诊' AND t_kc22.STA_DATE BETWEEN '2010-03-05' AND '2013-08-03' AND t_kc22.MED_INV_ITEM_TYPE = '检查费' | css |
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... | what is the name of the drug that was prescribed to patient 009-5001 in the same day, after having been diagnosed with lower gi bleeding this month? | SELECT t2.drugname FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-5001') AND diagnosis.diagnosi... | eicu |
CREATE TABLE party_host (
Party_ID int,
Host_ID int,
Is_Main_in_Charge bool
)
CREATE TABLE host (
Host_ID int,
Name text,
Nationality text,
Age text
)
CREATE TABLE party (
Party_ID int,
Party_Theme text,
Location text,
First_year text,
Last_year text,
Number_of_host... | What are the last year of the parties whose theme is 'Spring' or 'Teqnology'? Bin the last year into weekday interval and count them. | SELECT Last_year, COUNT(Last_year) FROM party WHERE Party_Theme = "Spring" OR Party_Theme = "Teqnology" | nvbench |
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wardid number,
admissionheight number,
admissionweight number,
dischargeweight number,
hospitaladmittime time,
... | what is the total quantity of output (ml)-ng/og tube orogastric center mouth output patient 005-46456 had on 11/05/last year? | SELECT SUM(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 = '005-46456')) AND intakeoutput.celllabel = 'outpu... | eicu |
CREATE TABLE table_9375 (
"Place" text,
"Player" text,
"Country" text,
"Score" real,
"To par" text
) | Which To par has a Player of emlyn aubrey? | SELECT "To par" FROM table_9375 WHERE "Player" = 'emlyn aubrey' | wikisql |
CREATE TABLE table_203_34 (
id number,
"season" text,
"appearance" number,
"interchange" number,
"tries" number,
"goals" number,
"f/g" number,
"points" number
) | how many more goals did he have in 2009 than 2005 ? | SELECT (SELECT "goals" FROM table_203_34 WHERE "season" = 2009) - (SELECT "goals" FROM table_203_34 WHERE "season" = 2005) | squall |
CREATE TABLE city (
County_ID VARCHAR,
White INTEGER
)
CREATE TABLE county_public_safety (
Crime_rate VARCHAR,
County_ID VARCHAR
) | Show the crime rate of counties with a city having white percentage more than 90. | SELECT T2.Crime_rate FROM city AS T1 JOIN county_public_safety AS T2 ON T1.County_ID = T2.County_ID WHERE T1.White > 90 | sql_create_context |
CREATE TABLE table_34410 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Game site" text,
"Attendance" real
) | Which Week has an Opponent of baltimore colts, and an Attendance smaller than 55,137? | SELECT AVG("Week") FROM table_34410 WHERE "Opponent" = 'baltimore colts' AND "Attendance" < '55,137' | wikisql |
CREATE TABLE table_53390 (
"NGC number" real,
"Object type" text,
"Constellation" text,
"Right ascension ( J2000 )" text,
"Declination ( J2000 )" text
) | what is the highest ngc number when the declination (j2000) is 25 26 ? | SELECT MAX("NGC number") FROM table_53390 WHERE "Declination ( J2000 )" = '°25′26″' | wikisql |
CREATE TABLE table_21625 (
"Series #" real,
"Season #" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text
) | What season episode is directed by Skipp Sudduth? | SELECT "Season #" FROM table_21625 WHERE "Directed by" = 'Skipp Sudduth' | wikisql |
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,0)
)
CREATE TABLE job_history (
EMPLO... | 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, find job_id and the average of department_id , and group by attribute job_id, and visualize them by a bar chart, I want to sort by the x-axis in desc. | SELECT JOB_ID, AVG(DEPARTMENT_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID ORDER BY JOB_ID DESC | nvbench |
CREATE TABLE table_51531 (
"Feb 2010" text,
"Mar 2010" text,
"May 2010" real,
"Jun 2010" real,
"Jul 2010" real,
"Aug 2010" real,
"Sep 2010" real,
"Oct 2010" real,
"Nov 2010" real,
"Dec 2010" real,
"Jan 2011" real,
"Feb 2011" real,
"Mar 2011" real,
"Apr 2011" real,... | What is the total number with Nov 2012 with a Jun 2013 larger than 542, and a Aug 2011 more than 935? | SELECT COUNT("Nov 2012") FROM table_51531 WHERE "Jun 2013" > '542' AND "Aug 2011" > '935' | wikisql |
CREATE TABLE table_1745843_2 (
part_1 VARCHAR,
class VARCHAR
) | What is listed under part 1 for class 3b? | SELECT part_1 FROM table_1745843_2 WHERE class = "3b" | sql_create_context |
CREATE TABLE table_17058178_11 (
high_rebounds VARCHAR,
date VARCHAR
) | Name the high reobounds for april 7 | SELECT high_rebounds FROM table_17058178_11 WHERE date = "April 7" | sql_create_context |
CREATE TABLE stadium (
id number,
name text,
capacity number,
city text,
country text,
opening_year number
)
CREATE TABLE record (
id number,
result text,
swimmer_id number,
event_id number
)
CREATE TABLE event (
id number,
name text,
stadium_id number,
year tex... | Find the name and capacity of the stadium where the event named 'World Junior' happened. | SELECT t1.name, t1.capacity FROM stadium AS t1 JOIN event AS t2 ON t1.id = t2.stadium_id WHERE t2.name = 'World Junior' | spider |
CREATE TABLE table_39223 (
"District" text,
"Incumbent" text,
"Party" text,
"First elected" real,
"Result" text
) | What district is the democratic Francis C. Le Blond from? | SELECT "District" FROM table_39223 WHERE "Party" = 'democratic' AND "Incumbent" = 'francis c. le blond' | wikisql |
CREATE TABLE management (
department_id VARCHAR,
head_id VARCHAR
)
CREATE TABLE department (
department_id VARCHAR,
name VARCHAR
)
CREATE TABLE head (
born_state VARCHAR,
head_id VARCHAR
) | List the states where both the secretary of 'Treasury' department and the secretary of 'Homeland Security' were born. | SELECT T3.born_state FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id JOIN head AS T3 ON T2.head_id = T3.head_id WHERE T1.name = 'Treasury' INTERSECT SELECT T3.born_state FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id JOIN head AS T3 ON T2.head_id = ... | sql_create_context |
CREATE TABLE PostNotices (
Id number,
PostId number,
PostNoticeTypeId number,
CreationDate time,
DeletionDate time,
ExpiryDate time,
Body text,
OwnerUserId number,
DeletionUserId number
)
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
Vote... | select * from posts where posts.ViewCount > 15000 and posts.ViewCount < 20000. | SELECT * FROM Posts WHERE Posts.ViewCount > 15000 AND Posts.ViewCount < 20000 | sede |
CREATE TABLE table_204_576 (
id number,
"year" number,
"best" text,
"location" text,
"date" text,
"world rank" text
) | how many times did bekele record a 10,000 metre year 's best in brussels ? | SELECT COUNT(*) FROM table_204_576 WHERE "location" = 'brussels' | squall |
CREATE TABLE table_name_6 (
super_g INTEGER,
downhill VARCHAR,
overall VARCHAR
) | What is the highest Super G that had an 11 Downhill and an overall less than 16? | SELECT MAX(super_g) FROM table_name_6 WHERE downhill = "11" AND overall < 16 | sql_create_context |
CREATE TABLE table_6863 (
"Couple" text,
"Style" text,
"Music" text,
"Choreographer(s)" text,
"Chosen by" text
) | What is Couple, when Choreographer(s) is Nakul Dev Mahajan? | SELECT "Couple" FROM table_6863 WHERE "Choreographer(s)" = 'nakul dev mahajan' | wikisql |
CREATE TABLE table_name_43 (
state_country VARCHAR,
skipper VARCHAR
) | WHICH State/country that has ray roberts? | SELECT state_country FROM table_name_43 WHERE skipper = "ray roberts" | sql_create_context |
CREATE TABLE table_71119 (
"Country" text,
"Film title used in nomination" text,
"Language" text,
"Original title" text,
"Director" text
) | What is the original title of the film for which Dersu Uzala was nominated? | SELECT "Original title" FROM table_71119 WHERE "Film title used in nomination" = 'dersu uzala' | wikisql |
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,
... | 在2008-01-03到2013-04-06内,患者59410862到1012815这个医疗机构看过多少次门诊 | SELECT COUNT(*) FROM hz_info JOIN txmzjzjlb ON hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX WHERE hz_info.RYBH = '59410862' AND txmzjzjlb.JZKSRQ BETWEEN '2008-01-03' AND '2013-04-06' AND txmzjzjlb.YLJGDM = '1012815' UNION SELECT COUNT(*) FROM hz_info JOIN ftxmzjzjlb ON... | css |
CREATE TABLE table_58100 (
"Year" real,
"Tournament" text,
"Venue" text,
"Result" text,
"Extra" text
) | Where was the universiade held in 1959? | SELECT "Venue" FROM table_58100 WHERE "Tournament" = 'universiade' AND "Year" = '1959' | wikisql |
CREATE TABLE table_28087 (
"Episode Number" real,
"Episode" text,
"Rating" text,
"Share" real,
"Rating/Share (18-49)" text,
"Viewers (millions)" text,
"Rank (Timeslot)" real,
"Rank (Night)" real
) | What is the lowest episode number that had a ratings/share (18-49) of 1.1/3? | SELECT MIN("Episode Number") FROM table_28087 WHERE "Rating/Share (18-49)" = '1.1/3' | wikisql |
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
)
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
) | For those products with a price between 60 and 120, draw a scatter chart about the correlation between code and price , and group by attribute name. | SELECT Code, Price FROM Products WHERE Price BETWEEN 60 AND 120 GROUP BY Name | nvbench |
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... | what is primary disease and procedure short title of subject name lue white? | SELECT demographic.diagnosis, procedures.short_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.name = "Lue White" | mimicsql_data |
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 text,
Age int,
Level int
)
CREATE TABLE railway_manage (
Railway_ID int,
M... | Give me a bar chart for how many name of each name | SELECT Name, COUNT(Name) FROM train GROUP BY Name | nvbench |
CREATE TABLE table_name_92 (
military_deaths VARCHAR,
total_casualties VARCHAR
) | How many military deaths were there when there were 1,615 total casualties? | SELECT military_deaths FROM table_name_92 WHERE total_casualties = "1,615" | sql_create_context |
CREATE TABLE table_203_102 (
id number,
"event" text,
"performance" text,
"athlete" text,
"nation" text,
"place" text,
"date" text
) | what is the number of countries listed in the table | SELECT COUNT(DISTINCT "nation") FROM table_203_102 | squall |
CREATE TABLE table_37828 (
"Rank" real,
"Name" text,
"Club" text,
"Nation" text,
"Points" real
) | What was the nationality of the skater with 108.8 points? | SELECT "Nation" FROM table_37828 WHERE "Points" = '108.8' | wikisql |
CREATE TABLE table_name_34 (
home_team VARCHAR,
away_team VARCHAR
) | who is the home team when the away team is ipswich town? | SELECT home_team FROM table_name_34 WHERE away_team = "ipswich town" | sql_create_context |
CREATE TABLE table_52441 (
"Player" text,
"Position" text,
"Tries" real,
"Goals" real,
"Points" real
) | What position did Lee Gilmour play while having more than 4 Tries and 20 points? | SELECT "Position" FROM table_52441 WHERE "Tries" > '4' AND "Points" = '20' AND "Player" = 'lee gilmour' | wikisql |
CREATE TABLE table_48648 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text,
"Money ( $ )" real
) | What player scored 70-73-69-72=284? | SELECT "Player" FROM table_48648 WHERE "Score" = '70-73-69-72=284' | wikisql |
CREATE TABLE Stay (
StayID INTEGER,
Patient INTEGER,
Room INTEGER,
StayStart DATETIME,
StayEnd DATETIME
)
CREATE TABLE Appointment (
AppointmentID INTEGER,
Patient INTEGER,
PrepNurse INTEGER,
Physician INTEGER,
Start DATETIME,
End DATETIME,
ExaminationRoom TEXT
)
CREATE... | Draw a bar chart for how many medications are prescribed for each brand?, rank in descending by the y axis. | SELECT Name, COUNT(*) FROM Medication AS T1 JOIN Prescribes AS T2 ON T1.Code = T2.Medication GROUP BY T1.Brand ORDER BY COUNT(*) DESC | nvbench |
CREATE TABLE table_name_74 (
date__ddmmyyyy_ VARCHAR,
soviet_unit VARCHAR,
enemy_aircraft VARCHAR
) | What was the date of the victory when the Soviet Unit was 73 giap, and the Enemy Aircraft was bf.109g-? w.nr.? | SELECT date__ddmmyyyy_ FROM table_name_74 WHERE soviet_unit = "73 giap" AND enemy_aircraft = "bf.109g-? w.nr.?" | sql_create_context |
CREATE TABLE Behavior_Incident (
student_id VARCHAR
)
CREATE TABLE STUDENTS (
student_id VARCHAR
) | How many students are not involved in any behavior incident? | SELECT COUNT(*) FROM STUDENTS WHERE NOT student_id IN (SELECT student_id FROM Behavior_Incident) | 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 lab (
subject_id text,
hadm_id text,
... | what is average age of patients whose discharge location is home and primary disease is aortic insufficiency\re-do sternotomy; aortic valve replacement ? | SELECT AVG(demographic.age) FROM demographic WHERE demographic.discharge_location = "HOME" AND demographic.diagnosis = "AORTIC INSUFFICIENCY\RE-DO STERNOTOMY; AORTIC VALVE REPLACEMENT " | mimicsql_data |
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
amount number
)
CREATE TABLE cost (
row_i... | what were the four most frequent drugs that were prescribed to patients in their 20s within 2 months after they had been diagnosed with osteoporosis nos until 2104? | SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE ... | mimic_iii |
CREATE TABLE table_29395 (
"Model Number" text,
"Frequency" text,
"L2 Cache" text,
"HT" text,
"Mult. 1" text,
"Voltage" text,
"TDP" text,
"Socket" text,
"Release date" text,
"Order Part Number" text
) | How much ht does the model with 10x mult. 1 have? | SELECT "HT" FROM table_29395 WHERE "Mult. 1" = '10x' | wikisql |
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,
... | indicate the daily maximum amount of heart rate for patient 26350 in 06/2104. | SELECT MAX(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 = 26350)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'hear... | mimic_iii |
CREATE TABLE table_name_8 (
week_4 VARCHAR,
week_5 VARCHAR,
week_2 VARCHAR
) | Who is in week 4 if week 5 is [month ended] and week 2 is April Ireland? | SELECT week_4 FROM table_name_8 WHERE week_5 = "[month ended]" AND week_2 = "april ireland" | sql_create_context |
CREATE TABLE table_72215 (
"Taxonomy" text,
"Species in the world" real,
"Species in Peru" real,
"Species in the Peruvian Amazon" real,
"Peru Vs. world (Percent)" real,
"Peruvian Amazon Vs. Peru (Percent)" real
) | what's the minimum species in the peruvian amazon with peru vs. world (percent) value of 7 | SELECT MIN("Species in the Peruvian Amazon") FROM table_72215 WHERE "Peru Vs. world (Percent)" = '7' | wikisql |
CREATE TABLE table_14855908_3 (
episodes VARCHAR,
region_1__us_ VARCHAR
) | How many episodes were released on DVD in the US on October 13, 2009? | SELECT episodes FROM table_14855908_3 WHERE region_1__us_ = "October 13, 2009" | sql_create_context |
CREATE TABLE code_description (
code varchar,
description text
)
CREATE TABLE flight (
aircraft_code_sequence text,
airline_code varchar,
airline_flight text,
arrival_time int,
connections int,
departure_time int,
dual_carrier text,
flight_days text,
flight_id int,
fligh... | what are the cheapest one way flights from ATLANTA to PITTSBURGH | SELECT DISTINCT fare.fare_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 = 'ATLANTA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city... | atis |
CREATE TABLE state (
state_code text,
state_name text,
country_name text
)
CREATE TABLE code_description (
code varchar,
description text
)
CREATE TABLE dual_carrier (
main_airline varchar,
low_flight_number int,
high_flight_number int,
dual_airline varchar,
service_name text
)... | US 3724 BALTIMORE to PHILADELPHIA what is the round trip fare | SELECT DISTINCT fare.fare_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 = 'BALTIMORE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.... | atis |
CREATE TABLE table_21964 (
"Parish (Prestegjeld)" text,
"Sub-Parish (Sogn)" text,
"Church Name" text,
"Year Built" real,
"Location of the Church" text
) | In what parish is the sub-parish fortun? | SELECT "Parish (Prestegjeld)" FROM table_21964 WHERE "Sub-Parish (Sogn)" = 'Fortun' | wikisql |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.