context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE t_kc22 (
MED_EXP_DET_ID text,
OVERALL_CD_ORG text,
OVERALL_CD_PERSON text,
MED_CLINIC_ID text,
MED_EXP_BILL_ID text,
SOC_SRT_DIRE_CD text,
SOC_SRT_DIRE_NM text,
DIRE_TYPE number,
CHA_ITEM_LEV number,
MED_INV_ITEM_TYPE text,
MED_DIRE_CD text,
MED_DIRE_NM text,... | 医疗就诊26786067488中所以的病人住院多久? | SELECT IN_HOSP_DAYS FROM t_kc21 WHERE MED_CLINIC_ID = '26786067488' | css |
CREATE TABLE table_17327264_3 (
date_of_appointment VARCHAR,
replaced_by VARCHAR
) | Name the date of appointment for petrik sander | SELECT date_of_appointment FROM table_17327264_3 WHERE replaced_by = "Petrik Sander" | sql_create_context |
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... | 查询出院诊断为I51.076的最低和最高医疗费总额,主要针对医院0012194的医疗记录 | SELECT MIN(t_kc24.MED_AMOUT), MAX(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc21_t_kc24.MED_CLINIC_ID IN (SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '0012194' AND t_kc21.OUT_DIAG_DIS_CD = 'I51.076') | css |
CREATE TABLE table_24644 (
"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
) | How many different amounts of winnings were there for the year when the team had an average finish of 17.4? | SELECT COUNT("Winnings") FROM table_24644 WHERE "Avg. Finish" = '17.4' | wikisql |
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,
... | how many days has passed since the first time patient 006-80884 has had enteral fibersource hn intake on the current icu visit? | SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', intakeoutput.intakeoutputtime)) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid =... | eicu |
CREATE TABLE table_44786 (
"Name of Deity" text,
"Bhuta(Tatwa)" text,
"Name of the Stone (Sila)" text,
"Name of the River" text,
"Name of the State where found in India" text
) | What is the name of the stone found in Andhra Pradesh, India? | SELECT "Name of the Stone (Sila)" FROM table_44786 WHERE "Name of the State where found in India" = 'andhra pradesh' | 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... | find the number of office admitted patients who have lab test item id 50818. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND lab.itemid = "50818" | mimicsql_data |
CREATE TABLE table_23598 (
"Draw" real,
"Artist" text,
"Song" text,
"Regions" real,
"Studio Audience" real,
"Press Jury" real,
"Oil Rig" real,
"Total Points" real,
"Place" text
) | What's the oil rig of the song with a draw number 9? | SELECT MIN("Oil Rig") FROM table_23598 WHERE "Draw" = '9' | wikisql |
CREATE TABLE table_name_69 (
location VARCHAR,
date VARCHAR
) | Where was the race on 28 dec 2010 held? | SELECT location FROM table_name_69 WHERE date = "28 dec 2010" | sql_create_context |
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... | what is the number of patients whose admission year is less than 2150 and lab test category is chemistry? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2150" AND lab."CATEGORY" = "Chemistry" | mimicsql_data |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE procedures (
... | what is subject name and date of birth of subject id 2110? | SELECT demographic.name, demographic.dob FROM demographic WHERE demographic.subject_id = "2110" | mimicsql_data |
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsystolic number,
systemicdiastolic number,
systemicmean number,
observationtime time
)
CREATE TABLE medication (
medi... | when was the first time that the heartrate of patient 006-158689 was measured / taken? | SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-158689')) AND NOT vitalperiodic.heartrate IS NU... | eicu |
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... | 在医院4072141中给患者74583279开出的单价最高的药品编号都是?药品名称都叫什么? | 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_ID = '74583279' AND t_kc21.MED_SER_ORG_NO = '4072141') ORDER BY t_kc22.UNIVALENT DESC LIMIT 1 | css |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid numb... | when was the last time patient 013-3028 was discharged in 2104 from the hospital? | SELECT patient.hospitaldischargetime FROM patient WHERE patient.uniquepid = '013-3028' AND STRFTIME('%y', patient.hospitaldischargetime) = '2104' ORDER BY patient.hospitaldischargetime DESC LIMIT 1 | eicu |
CREATE TABLE table_47883 (
"Poll Source" text,
"Dates administered" text,
"Democrat: Beverly Perdue" text,
"Republican: Pat McCrory" text,
"Libertarian: Michael Munger" text,
"Lead Margin" real
) | What is the percentage of Perdue when McCrory has 37% and Munger has 6%? | SELECT "Democrat: Beverly Perdue" FROM table_47883 WHERE "Republican: Pat McCrory" = '37%' AND "Libertarian: Michael Munger" = '6%' | wikisql |
CREATE TABLE degrees (
year number,
campus number,
degrees number
)
CREATE TABLE enrollments (
campus number,
year number,
totalenrollment_ay number,
fte_ay number
)
CREATE TABLE faculty (
campus number,
year number,
faculty number
)
CREATE TABLE csu_fees (
campus number,
... | What campus had more than 400 total enrollment but more than 200 full time enrollment in year 1956? | SELECT T1.campus FROM campuses AS t1 JOIN enrollments AS t2 ON t1.id = t2.campus WHERE t2.year = 1956 AND totalenrollment_ay > 400 AND fte_ay > 200 | spider |
CREATE TABLE table_33323 (
"Country" text,
"Area (km\u00b2) 2010" text,
"Population 2011" text,
"GDP (PPP) ( Intl. $ ) 2011" text,
"GDP (PPP) per capita ( Intl. $ ) 2011" text,
"Income inequality 1994\u20132011 (latest available)" text,
"HDI 2011" text,
"FSI 2012" text,
"CPI 2011" te... | What is the latest available income inequality for the country with a population of 21,315,135? | SELECT "Income inequality 1994\u20132011 (latest available)" FROM table_33323 WHERE "Population 2011" = '21,315,135' | wikisql |
CREATE TABLE table_name_31 (
runner_up VARCHAR,
location VARCHAR
) | Who was the Runner-up when the game was played at Bells Beach? | SELECT runner_up FROM table_name_31 WHERE location = "bells beach" | 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,
... | give me the number of patients whose admission year is less than 2125 and item id is 50970? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2125" AND lab.itemid = "50970" | mimicsql_data |
CREATE TABLE weekly_weather (
station_id int,
day_of_week text,
high_temperature int,
low_temperature int,
precipitation real,
wind_speed_mph int
)
CREATE TABLE train (
id int,
train_number int,
name text,
origin text,
destination text,
time text,
interval text
)
CR... | What is the average high temperature for each day of week Plot them as bar chart, and could you order in desc by the x-axis? | SELECT day_of_week, AVG(high_temperature) FROM weekly_weather GROUP BY day_of_week ORDER BY day_of_week DESC | nvbench |
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 d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE transfers (
r... | when was patient 84476 given for the first time a lab test since 61 months ago? | SELECT labevents.charttime FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 84476) AND DATETIME(labevents.charttime) >= DATETIME(CURRENT_TIME(), '-61 month') ORDER BY labevents.charttime LIMIT 1 | mimic_iii |
CREATE TABLE table_name_26 (
role VARCHAR,
language VARCHAR,
year VARCHAR
) | What role is spoken in hindi in 2011? | SELECT role FROM table_name_26 WHERE language = "hindi" AND year = 2011 | sql_create_context |
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 COUNT(gwyjzb.PERSON_ID) FROM gwyjzb WHERE gwyjzb.IN_DIAG_DIS_NM = '腔隙性脑梗死' UNION SELECT COUNT(fgwyjzb.PERSON_ID) FROM fgwyjzb WHERE fgwyjzb.IN_DIAG_DIS_NM = '腔隙性脑梗死' | css |
CREATE TABLE table_12201 (
"Preferences" text,
"1. vs 2." real,
"1. vs 3." real,
"2. vs 3." real,
"Total" real
) | What is the 2 vs 3 when total is bigger than 38? | SELECT AVG("2. vs 3.") FROM table_12201 WHERE "Total" > '38' | 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 procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
... | what number of patients admitted in emergency room were born before the year 2098? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND demographic.dob_year < "2098" | mimicsql_data |
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... | 在门诊就诊的病人被诊断为疾病F51.X21的,其血清铁数值的平均值以及最值分别是多少 | 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_name_87 (
husband VARCHAR,
image VARCHAR
) | Who is the husband of the image of renata of lorraine? | SELECT husband FROM table_name_87 WHERE image = "renata of lorraine" | sql_create_context |
CREATE TABLE table_13399573_4 (
points_against VARCHAR,
points VARCHAR
) | In the 2008/2009 season one team had a season total points of 31, for that team how many total points were scored against them? | SELECT points_against FROM table_13399573_4 WHERE points = "31" | sql_create_context |
CREATE TABLE table_14997 (
"Wrestler" text,
"Reigns" text,
"Days held" real,
"Location" text,
"Successful defenses" text,
"Event" text
) | Which event has Philadelphia, PA as the location and 41 days held? | SELECT "Event" FROM table_14997 WHERE "Location" = 'philadelphia, pa' AND "Days held" = '41' | 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... | let me know the short title of procedure and primary disease of patient gus marques. | SELECT demographic.diagnosis, procedures.short_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.name = "Gus Marques" | mimicsql_data |
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 ethnicity is american indian/alaska native and admission year is less than 2145? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND demographic.admityear < "2145" | mimicsql_data |
CREATE TABLE climber (
climber_id number,
name text,
country text,
time text,
points number,
mountain_id number
)
CREATE TABLE mountain (
mountain_id number,
name text,
height number,
prominence number,
range text,
country text
) | List the distinct ranges of the mountains with the top 3 prominence. | SELECT DISTINCT range FROM mountain ORDER BY prominence DESC LIMIT 3 | spider |
CREATE TABLE table_29102100_1 (
prod_code INTEGER,
directed_by VARCHAR
) | What was the production code of the episode directed by Rondell Sheridan? | SELECT MAX(prod_code) FROM table_29102100_1 WHERE directed_by = "Rondell Sheridan" | sql_create_context |
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 employees (
EMPLOYEE_ID decimal(6,0),
FIRST_NAME varchar(20),
LAST_NAME varchar(25),
EMAIL varchar(25),
PHONE_NUMBER varchar(20),
... | 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, visualize a line chart about the change of salary over hire_date , sort HIRE_DATE in desc order. | SELECT HIRE_DATE, SALARY FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY HIRE_DATE DESC | nvbench |
CREATE TABLE table_5345 (
"Year" text,
"Men's singles" text,
"Women's singles" text,
"Men's doubles" text,
"Women's doubles" text,
"Mixed doubles" text
) | Who was the men's single in 1940? | SELECT "Men's singles" FROM table_5345 WHERE "Year" = '1940' | wikisql |
CREATE TABLE table_1481865_1 (
number_of_episode VARCHAR,
title__english_ VARCHAR
) | What is the episode number where the English title is Pilot? | SELECT number_of_episode FROM table_1481865_1 WHERE title__english_ = "Pilot" | sql_create_context |
CREATE TABLE table_69659 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Attendance" real,
"Record" text
) | What was the highest attendance of a game that had a score of 3-5? | SELECT MAX("Attendance") FROM table_69659 WHERE "Score" = '3-5' | wikisql |
CREATE TABLE table_name_4 (
role VARCHAR,
pick__number VARCHAR
) | What is Pick #18's Role? | SELECT role FROM table_name_4 WHERE pick__number = 18 | sql_create_context |
CREATE TABLE table_30584 (
"No. in series" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date (U.S.)" text,
"Original air date (International)" text
) | What date did the episode written by Mitch Watson and directed by Curt Geda originally air in the U.S.? | SELECT "Original air date (U.S.)" FROM table_30584 WHERE "Directed by" = 'Curt Geda' AND "Written by" = 'Mitch Watson' | wikisql |
CREATE TABLE table_39923 (
"School" text,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text
) | What is the class of the Middletown High School team that is in the DSHA league? | SELECT "Class" FROM table_39923 WHERE "League" = 'dsha' AND "School" = 'middletown high school' | wikisql |
CREATE TABLE table_203_36 (
id number,
"parish" text,
"locality" text,
"parish priest" text,
"founded" number,
"closed" number
) | other than st mary , which parish was founded by fr frank thorpe ? | SELECT "parish" FROM table_203_36 WHERE "parish" <> 'st mary' AND "parish priest" = 'fr frank thorpe' | squall |
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugst... | is it patient 002-64535's hct second measured on the first hospital visit less than first measured on the first hospital visit? | SELECT (SELECT 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 = '002-64535' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospi... | eicu |
CREATE TABLE table_54208 (
"Player" text,
"Nationality" text,
"Position" text,
"Years for Jazz" text,
"School/Club Team" text
) | What Utah Jazz guard, played at BYU? | SELECT "Player" FROM table_54208 WHERE "Position" = 'guard' AND "School/Club Team" = 'byu' | wikisql |
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... | Is the only person who teaches Nutrition Prof. Pifer ? | SELECT DISTINCT course.department, course.name, course.number, instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.name LIKE '%Nutrition%' AND NOT instructor.name LIKE '%Pifer%' AND offering_instructor.instructor_id = instructor.ins... | advising |
CREATE TABLE employees (
EMPLOYEE_ID decimal(6,0),
FIRST_NAME varchar(20),
LAST_NAME varchar(25),
EMAIL varchar(25),
PHONE_NUMBER varchar(20),
HIRE_DATE date,
JOB_ID varchar(10),
SALARY decimal(8,2),
COMMISSION_PCT decimal(2,2),
MANAGER_ID decimal(6,0),
DEPARTMENT_ID decimal(... | For those employees who was hired before 2002-06-21, give me the comparison about the sum of department_id over the hire_date bin hire_date by weekday by a bar chart, sort sum department id in ascending order. | SELECT HIRE_DATE, SUM(DEPARTMENT_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY SUM(DEPARTMENT_ID) | nvbench |
CREATE TABLE table_42324 (
"Team" text,
"Match" real,
"Points" real,
"Draw" real,
"Lost" real
) | How many matches ended with more than 22 points? | SELECT SUM("Match") FROM table_42324 WHERE "Points" > '22' | wikisql |
CREATE TABLE teaches (
ID varchar(5),
course_id varchar(8),
sec_id varchar(8),
semester varchar(6),
year numeric(4,0)
)
CREATE TABLE section (
course_id varchar(8),
sec_id varchar(8),
semester varchar(6),
year numeric(4,0),
building varchar(15),
room_number varchar(7),
t... | What is the sum of credit value of courses with more than one prerequisite for each title? Return a bar chart, could you order in descending by the names? | SELECT title, SUM(credits) FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY title ORDER BY title DESC | nvbench |
CREATE TABLE table_14835674_1 (
introductory_phrase VARCHAR,
original_airdate VARCHAR
) | What was the inroductory phase for the episode that originally aired january 21? | SELECT introductory_phrase FROM table_14835674_1 WHERE original_airdate = "January 21" | sql_create_context |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id t... | specify primary disease and lab test category of patient id 24425 | SELECT demographic.diagnosis, lab."CATEGORY" FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.subject_id = "24425" | mimicsql_data |
CREATE TABLE STUDENT (
STU_NUM int,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int
)
CREATE TABLE EM... | Pie. how many departments are in each school? | SELECT SCHOOL_CODE, COUNT(DISTINCT DEPT_NAME) FROM DEPARTMENT | nvbench |
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... | what is average age of patients whose marital status is married and gender is f? | SELECT AVG(demographic.age) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.gender = "F" | mimicsql_data |
CREATE TABLE table_203_683 (
id number,
"season" text,
"league" text,
"gold" text,
"silver" text,
"bronze" text,
"winning manager" text
) | no team has more cup wins than this team ? | SELECT "gold" FROM table_203_683 GROUP BY "gold" ORDER BY COUNT(*) DESC LIMIT 1 | squall |
CREATE TABLE table_29282 (
"Position" real,
"Building" text,
"City" text,
"Height" text,
"Number of floors" real,
"Completion" real
) | If the building is Costanera Center Torre 1, what is the height? | SELECT "Height" FROM table_29282 WHERE "Building" = 'Costanera Center Torre 1' | wikisql |
CREATE TABLE basketball_match (
Team_ID int,
School_ID int,
Team_Name text,
ACC_Regular_Season text,
ACC_Percent text,
ACC_Home text,
ACC_Road text,
All_Games text,
All_Games_Percent int,
All_Home text,
All_Road text,
All_Neutral text
)
CREATE TABLE university (
Scho... | Return a bar chart about the distribution of ACC_Road and the sum of School_ID , and group by attribute ACC_Road, and rank by the total number from high to low. | SELECT ACC_Road, SUM(School_ID) FROM basketball_match GROUP BY ACC_Road ORDER BY SUM(School_ID) DESC | nvbench |
CREATE TABLE table_name_4 (
bronze VARCHAR,
total VARCHAR,
silver VARCHAR
) | How many bronze medals did the team have with 0 total silver and less than 3 total medals? | SELECT bronze FROM table_name_4 WHERE total < 3 AND silver > 0 | sql_create_context |
CREATE TABLE table_16060 (
"Round" real,
"Choice" real,
"Overall" real,
"Player name" text,
"Position" text,
"College" text
) | Overall pick 240 was a pick in which round? | SELECT "Round" FROM table_16060 WHERE "Overall" = '240' | wikisql |
CREATE TABLE table_203_153 (
id number,
"stamp issue date" text,
"stamp set" text,
"#cards" text,
"card set ref" text,
"qty. issued" number
) | which stamp set had the greatest quantity issued ? | SELECT "stamp set" FROM table_203_153 ORDER BY "qty. issued" DESC LIMIT 1 | squall |
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
)
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
) | For those records from the products and each product's manufacturer, draw a scatter chart about the correlation between manufacturer and code . | SELECT T1.Manufacturer, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code | nvbench |
CREATE TABLE table_64332 (
"Year" real,
"1st Place Team" text,
"2nd Place Team" text,
"3rd Place Team" text,
"4th Place Team" text,
"Host Location" text
) | What location hosted when Wells Motors, Greeley, Co was the 4th place team? | SELECT "Host Location" FROM table_64332 WHERE "4th Place Team" = 'wells motors, greeley, co' | 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 procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE diagnoses (
... | what is the number of patients whose primary disease is st elevated myocardial infarction\cardiac cath and admission year is less than 2103? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "ST ELEVATED MYOCARDIAL INFARCTION\CARDIAC CATH" AND demographic.admityear < "2103" | mimicsql_data |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id... | count the number of patients whose ethnicity is hispanic or latino and days of hospital stay is greater than 20? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "HISPANIC OR LATINO" AND demographic.days_stay > "20" | mimicsql_data |
CREATE TABLE table_1242 (
"Year" real,
"Division" real,
"League" text,
"Regular Season" text,
"Playoffs" text,
"Open Cup" text
) | What was the regular season from year 2012? | SELECT "Regular Season" FROM table_1242 WHERE "Year" = '2012' | wikisql |
CREATE TABLE table_42336 (
"State / Territory" text,
"Building" text,
"Height" text,
"Floor count" real,
"Completed" real
) | What state/territory has lovett tower as the building? | SELECT "State / Territory" FROM table_42336 WHERE "Building" = 'lovett tower' | wikisql |
CREATE TABLE table_67522 (
"Driver" text,
"Constructor" text,
"Laps" text,
"Time/Retired" text,
"Grid" text
) | Who was the driver when there were 35 laps? | SELECT "Driver" FROM table_67522 WHERE "Laps" = '35' | 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... | what is the number of patients whose death status is 1 and primary disease is chest pain? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.expire_flag = "1" AND demographic.diagnosis = "CHEST PAIN" | mimicsql_data |
CREATE TABLE table_9563 (
"Name" text,
"Mi from Kingston" real,
"Km from Kingston" real,
"Parish" text,
"Length feet" real,
"Length meters" real
) | What is Lenth Feet, when Mi From Kingston is greater than 84.5, when Length Meters is greater than 55.5, and when Name is Unnamed? | SELECT "Length feet" FROM table_9563 WHERE "Mi from Kingston" > '84.5' AND "Length meters" > '55.5' AND "Name" = 'unnamed' | wikisql |
CREATE TABLE table_name_69 (
second_quarter VARCHAR,
rank VARCHAR
) | With a rank of 2 what is the second quarter? | SELECT second_quarter FROM table_name_69 WHERE rank = 2 | sql_create_context |
CREATE TABLE table_name_22 (
nation VARCHAR,
places VARCHAR
) | What Nation Placed 122.5? | SELECT nation FROM table_name_22 WHERE places = 122.5 | 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... | calculate the average age of widowed patients with private insurance. | SELECT AVG(demographic.age) FROM demographic WHERE demographic.marital_status = "WIDOWED" AND demographic.insurance = "Private" | mimicsql_data |
CREATE TABLE table_69415 (
"Format" text,
"Filename extension" text,
"Image support" text,
"Interactivity support" text,
"Word wrap support" text,
"Open standard" text
) | Which Filename extension has an Interactivity support of no, an Open standard of yes, and an Image support of no? | SELECT "Filename extension" FROM table_69415 WHERE "Interactivity support" = 'no' AND "Open standard" = 'yes' AND "Image support" = 'no' | wikisql |
CREATE TABLE table_name_37 (
player VARCHAR,
pick VARCHAR,
position VARCHAR
) | Which Player has a Pick larger than 2, and a Position of forward? | SELECT player FROM table_name_37 WHERE pick > 2 AND position = "forward" | sql_create_context |
CREATE TABLE table_75822 (
"Player" text,
"FG Pct" real,
"3FGA" real,
"3FGM" real,
"3FG Pct" real,
"FT Pct" real,
"Off Reb" real,
"Def Reb" real,
"Total Reb" real,
"Asst" real
) | What is the total number of offensive rebounds for players with under 65 total rebounds, 5 defensive rebounds, and under 7 assists? | SELECT COUNT("Off Reb") FROM table_75822 WHERE "Total Reb" < '65' AND "Def Reb" = '5' AND "Asst" < '7' | wikisql |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE demographic (... | how many patients with private health insurance had ureteral catheterization procedure? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Private" AND procedures.short_title = "Ureteral catheterization" | mimicsql_data |
CREATE TABLE table_name_4 (
score VARCHAR,
home_team VARCHAR
) | What's the score when the Wolverhampton Wanderers played at home? | SELECT score FROM table_name_4 WHERE home_team = "wolverhampton wanderers" | 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 demographic (... | count the number of patients whose admission type is urgent and item id is 50803? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "URGENT" AND lab.itemid = "50803" | mimicsql_data |
CREATE TABLE table_200_14 (
id number,
"act" text,
"year signed" number,
"# albums released under bad boy" number
) | what year did machine gun kelly sign with bad boy records ? | SELECT "year signed" FROM table_200_14 WHERE "act" = 'machine gun kelly' | squall |
CREATE TABLE table_69995 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Record" text
) | What's the Score with the Visitor of Montreal Maroons and has a Date of December 28? | SELECT "Score" FROM table_69995 WHERE "Visitor" = 'montreal maroons' AND "Date" = 'december 28' | wikisql |
CREATE TABLE table_name_64 (
country VARCHAR,
place VARCHAR,
player VARCHAR
) | What is the Country, when Place is 'T4', and when Player is 'Scott Simpson'? | SELECT country FROM table_name_64 WHERE place = "t4" AND player = "scott simpson" | sql_create_context |
CREATE TABLE table_11890 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What is the size of the biggest crowd for a game where Fitzroy was the away team? | SELECT MAX("Crowd") FROM table_11890 WHERE "Away team" = 'fitzroy' | wikisql |
CREATE TABLE table_2886617_9 (
college_junior_club_team VARCHAR,
nhl_team VARCHAR
) | What college club team did the Dallas Stars choose their draft pick from? | SELECT college_junior_club_team FROM table_2886617_9 WHERE nhl_team = "Dallas Stars" | sql_create_context |
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE cost (
costid number,
uniquepid text,... | when did patient 004-13127 have urine output first time in a day before? | SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-13127')) AND intakeoutput.cellpath LIKE '%output%... | eicu |
CREATE TABLE table_40075 (
"Ring name" text,
"Current rank" text,
"Debut" text,
"Stable" text,
"Birthplace" text
) | What is Ring Name, when Stable is Kasugano, and when Birthplace is Z Mtskheta , Georgia? | SELECT "Ring name" FROM table_40075 WHERE "Stable" = 'kasugano' AND "Birthplace" = 'z mtskheta , georgia' | wikisql |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
h... | in 2105, how many patients were diagnosed with obtundation during the same hospital encounter after having underwent oxygen therapy (> 60%)? | SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'oxygen therapy (> 60%)' AND STRFTIME('%y', treatment.treatmenttime) = '21... | eicu |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid num... | tell me the percentile of bedside glucose worth 241.0 for patients of the same age as patient 032-9900 during the first hospital visit? | SELECT DISTINCT t1.c1 FROM (SELECT lab.labresult, PERCENT_RANK() OVER (ORDER BY lab.labresult) AS c1 FROM lab WHERE lab.labname = 'bedside glucose' AND lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age = (SELECT patient.age FROM patient WHERE patient.uniquepid = '032-9900' AND NO... | eicu |
CREATE TABLE table_45244 (
"Season" real,
"Series" text,
"Team" text,
"Races" text,
"Wins" text,
"Poles" text,
"F/Laps" text,
"Podiums" text,
"Points" text,
"Position" text
) | What Position is Team Sahara Force india f1 team with 46 Points? | SELECT "Position" FROM table_45244 WHERE "Team" = 'sahara force india f1 team' AND "Points" = '46' | wikisql |
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
value number
)
CREATE TABLE tr... | what's the time for the hospital admission of patient 22756? | SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 22756 | mimic_iii |
CREATE TABLE table_39819 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Leading scorer" text,
"Attendance" text,
"Record" text
) | What is Score, when Leading Scorer is Tyrone Hill , 20 Points? | SELECT "Score" FROM table_39819 WHERE "Leading scorer" = 'tyrone hill , 20 points' | wikisql |
CREATE TABLE table_204_603 (
id number,
"pos" text,
"no" number,
"rider" text,
"bike" text,
"laps" number,
"time" text,
"grid" number,
"points" number
) | how many points did jonas folger score ? | SELECT "points" FROM table_204_603 WHERE "rider" = 'jonas folger' | squall |
CREATE TABLE table_30067 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
) | How many people are high assists when location attendance is Seattle Center Coliseum 14,180? | SELECT COUNT("High assists") FROM table_30067 WHERE "Location Attendance" = 'Seattle Center Coliseum 14,180' | 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 procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
... | How many patients have drug code mags1i and had an ascitic fluid lab test done? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.formulary_drug_cd = "MAGS1I" AND lab.fluid = "Ascites" | mimicsql_data |
CREATE TABLE table_name_12 (
dynamo INTEGER,
draw VARCHAR,
spartak VARCHAR,
competition VARCHAR
) | what is the least dynamo when spartak is more than 9, competition is totals and draw is more than 24? | SELECT MIN(dynamo) FROM table_name_12 WHERE spartak > 9 AND competition = "totals" AND draw > 24 | sql_create_context |
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... | 在05年3月16日到2014年5月31日间病患18467147主要看了什么疾病? | SELECT gwyjzb.IN_DIAG_DIS_CD, gwyjzb.IN_DIAG_DIS_NM FROM gwyjzb WHERE gwyjzb.PERSON_ID = '18467147' AND gwyjzb.IN_HOSP_DATE BETWEEN '2005-03-16' AND '2014-05-31' GROUP BY gwyjzb.IN_DIAG_DIS_CD ORDER BY COUNT(*) DESC LIMIT 1 UNION SELECT fgwyjzb.IN_DIAG_DIS_CD, fgwyjzb.IN_DIAG_DIS_NM FROM fgwyjzb WHERE fgwyjzb.PERSON_ID... | css |
CREATE TABLE table_name_53 (
bronze INTEGER,
gold INTEGER
) | What is the bronze number for the nation with less than 0 gold? | SELECT MIN(bronze) FROM table_name_53 WHERE gold < 0 | sql_create_context |
CREATE TABLE table_1939202_2 (
year VARCHAR,
us_open_cup VARCHAR,
league VARCHAR,
playoffs VARCHAR
) | What year at the US Open Cup quarterfinals, were the playoffs in the semifinals for the USL second division? | SELECT year FROM table_1939202_2 WHERE league = "USL Second division" AND playoffs = "Semifinals" AND us_open_cup = "Quarterfinals" | sql_create_context |
CREATE TABLE guests (
guest_id number,
gender_code text,
guest_first_name text,
guest_last_name text,
date_of_birth time
)
CREATE TABLE view_unit_status (
apt_id number,
apt_booking_id number,
status_date time,
available_yn others
)
CREATE TABLE apartments (
apt_id number,
... | Show the total number of rooms of all apartments with facility code 'Gym'. | SELECT SUM(T2.room_count) FROM apartment_facilities AS T1 JOIN apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.facility_code = "Gym" | spider |
CREATE TABLE table_name_64 (
celebrity VARCHAR,
exited VARCHAR
) | Who exited on Day 12? | SELECT celebrity FROM table_name_64 WHERE exited = "day 12" | sql_create_context |
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,
... | 列出患者90180222的检验报告单日期在2021年6月7日之后的所对应的住院就诊的流水号 | 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 = '90180222' AND NOT zyjzjlb.JZLSH IN (SELECT jybgb.JZLSH FROM jybgb WHERE jybgb.BGRQ <= '2021-06-07') | css |
CREATE TABLE table_25955 (
"Game" real,
"Date" text,
"Opponent" text,
"Score" text,
"Location" text,
"Attendance" real,
"Record" text,
"Points" real
) | How many times was there a record of 49-15-11? | SELECT COUNT("Attendance") FROM table_25955 WHERE "Record" = '49-15-11' | wikisql |
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
)
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
) | For those records from the products and each product's manufacturer, give me the comparison about the average of code over the name , and group by attribute name, order from high to low by the names. | SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Name DESC | nvbench |
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... | Does class 381 include a project ? | SELECT DISTINCT has_projects FROM course WHERE department = 'EECS' AND number = 381 | advising |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.