context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
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 is the number of patients whose diagnoses long title is atrial flutter? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.long_title = "Atrial flutter" | mimicsql_data |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wa... | count the number of patients who have received a urine, catheter specimen microbiology testing during the previous year. | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT microlab.patientunitstayid FROM microlab WHERE microlab.culturesite = 'urine, catheter specimen' AND DATETIME(microlab.culturetakentime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) | eicu |
CREATE TABLE table_name_68 (
surface VARCHAR,
date VARCHAR
) | Which Surface has a Date of january 2, 2006? | SELECT surface FROM table_name_68 WHERE date = "january 2, 2006" | sql_create_context |
CREATE TABLE table_name_74 (
format VARCHAR,
type VARCHAR,
call_letters VARCHAR
) | Type of primary, and a Call letters of kbjs has what format? | SELECT format FROM table_name_74 WHERE type = "primary" AND call_letters = "kbjs" | sql_create_context |
CREATE TABLE table_22265716_1 (
director VARCHAR,
film_title_used_in_nomination VARCHAR
) | Who directed the film with the title three summer days? | SELECT director FROM table_22265716_1 WHERE film_title_used_in_nomination = "Three Summer Days" | sql_create_context |
CREATE TABLE table_63901 (
"Year" real,
"Main" text,
"Hessen" text,
"Rhein" text,
"Saar" text
) | What is the smallest year for a Main of Eintracht Frankfurt, Rhein of Waldhof Mannheim, Sarr of FK Pirmasens, and Hessen of Wormatia Worms? | SELECT MIN("Year") FROM table_63901 WHERE "Main" = 'eintracht frankfurt' AND "Rhein" = 'waldhof mannheim' AND "Saar" = 'fk pirmasens' AND "Hessen" = 'wormatia worms' | 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,
... | count the number of patients who have received a laboratory cortisol test in 2104. | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT lab.patientunitstayid FROM lab WHERE lab.labname = 'cortisol' AND STRFTIME('%y', lab.labresulttime) = '2104') | eicu |
CREATE TABLE table_24700 (
"Series #" real,
"Season #" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Prod. code" text
) | how many maximum series number have 2apx05 prod. code. | SELECT MAX("Series #") FROM table_24700 WHERE "Prod. code" = '2APX05' | wikisql |
CREATE TABLE table_204_467 (
id number,
"date" text,
"opponents" text,
"h/a" text,
"result\nf-a" text,
"scorers" text,
"attendance" number
) | last opponent for manchester united in the season | SELECT "opponents" FROM table_204_467 ORDER BY "date" DESC LIMIT 1 | squall |
CREATE TABLE stadium (
ID int,
name text,
Capacity int,
City text,
Country text,
Opening_year int
)
CREATE TABLE record (
ID int,
Result text,
Swimmer_ID int,
Event_ID int
)
CREATE TABLE swimmer (
ID int,
name text,
Nationality text,
meter_100 real,
meter_20... | Give me the comparison about meter_100 over the meter_700 , could you show bars in desc order? | SELECT meter_700, meter_100 FROM swimmer ORDER BY meter_700 DESC | nvbench |
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 intakeoutput (
... | until 1 year ago, what are the top three most common specimen tests given to patients within 2 months after diagnosis of adrenal insufficiency? | SELECT t3.culturesite FROM (SELECT t2.culturesite, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'adrenal insufficiency' AND DATETIME(diagnosi... | eicu |
CREATE TABLE table_name_48 (
runner_s__up VARCHAR,
margin VARCHAR
) | Which runner-up player(s) had a margin of 10 strokes? | SELECT runner_s__up FROM table_name_48 WHERE margin = "10 strokes" | 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... | find the age and marital status of patient with patient id 2560. | SELECT demographic.marital_status, demographic.age FROM demographic WHERE demographic.subject_id = "2560" | mimicsql_data |
CREATE TABLE table_45013 (
"Fin. Pos" text,
"Car No." text,
"Driver" text,
"Team" text,
"Laps" text,
"Time/Retired" text,
"Grid" text,
"Laps Led" text,
"Points" text
) | What were the number of laps led by the driver with a finish position of 14? | SELECT "Laps Led" FROM table_45013 WHERE "Fin. Pos" = '14' | wikisql |
CREATE TABLE table_10083598_1 (
no VARCHAR,
pole_position VARCHAR
) | What was the number of race that Kevin Curtain won? | SELECT COUNT(no) FROM table_10083598_1 WHERE pole_position = "Kevin Curtain" | sql_create_context |
CREATE TABLE table_1342270_3 (
result VARCHAR,
district VARCHAR
) | what are all the result with district being alabama 1 | SELECT result FROM table_1342270_3 WHERE district = "Alabama 1" | sql_create_context |
CREATE TABLE mzjzjlb (
HXPLC number,
HZXM text,
JLSJ time,
JZJSSJ time,
JZKSBM text,
JZKSMC text,
JZKSRQ time,
JZLSH text,
JZZDBM text,
JZZDSM text,
JZZTDM number,
JZZTMC text,
KH text,
KLX number,
MJZH text,
ML number,
MZZYZDZZBM text,
MZZYZDZZMC ... | 病患郑自珍大腿的检测各项指标结果如何? | SELECT * FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN mzjzjlb_jybgb 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 AND mzjzjlb.YLJGDM = mzjzjlb_jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jy... | css |
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
enddate time,
drug text,
dose_val_rx text,
dose_unit_rx text,
route text
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
... | count the number of patients that were prescribed aspirin ec within 2 months after having received a venous cath nec procedure until 4 years ago. | SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'venous cath... | mimic_iii |
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,0)
)
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,... | For those employees who do not work in departments with managers that have ids between 100 and 200, a bar chart shows the distribution of email and salary , and rank total number in descending order. | SELECT EMAIL, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SALARY DESC | nvbench |
CREATE TABLE table_name_79 (
printer VARCHAR,
date_of_issue VARCHAR
) | Which printer issued sheets on October 5, 2006? | SELECT printer FROM table_name_79 WHERE date_of_issue = "october 5, 2006" | 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... | 尤飞双这位患者在就诊期间购买的药物价格超了7155.47元的次数有几次?都对应了什么编号? | SELECT gwyjzb.MED_CLINIC_ID FROM gwyjzb WHERE gwyjzb.PERSON_NM = '尤飞双' AND gwyjzb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT > 7155.47) UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb WHERE fgwyjzb.PERSON_NM = '尤飞双' AND fgwyjzb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22... | css |
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
)
... | Among patients treated with base drug, how many of them were born before the year 2182? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "2182" AND prescriptions.drug_type = "BASE" | mimicsql_data |
CREATE TABLE table_name_36 (
président VARCHAR,
party VARCHAR,
départment__or_collectivity_ VARCHAR
) | Who is the president from the Union for a Popular Movement party that represents the Hautes-Alpes department? | SELECT président FROM table_name_36 WHERE party = "union for a popular movement" AND départment__or_collectivity_ = "hautes-alpes" | sql_create_context |
CREATE TABLE table_name_63 (
points INTEGER,
chassis VARCHAR,
year VARCHAR
) | Name the average points for dallara 3087 lola t88/50 and year before 1988 | SELECT AVG(points) FROM table_name_63 WHERE chassis = "dallara 3087 lola t88/50" AND year < 1988 | sql_create_context |
CREATE TABLE table_48896 (
"Date" text,
"Place" text,
"Race winners" text,
"GP winner" text,
"Source" text
) | What is the source on 6 September? | SELECT "Source" FROM table_48896 WHERE "Date" = '6 september' | wikisql |
CREATE TABLE table_80246 (
"Representative" text,
"Title" text,
"Presentation of Credentials" text,
"Termination of Mission" text,
"Appointed by" text
) | What is the Termination of Mission date for Marsha E. Barnes, the Ambassador Extraordinary and Plenipotentiary? | SELECT "Termination of Mission" FROM table_80246 WHERE "Title" = 'ambassador extraordinary and plenipotentiary' AND "Representative" = 'marsha e. barnes' | wikisql |
CREATE TABLE table_76251 (
"City" text,
"Country" text,
"IATA" text,
"ICAO" text,
"Airport" text
) | What is the ICAO for Denmark, and the IATA is bll? | SELECT "ICAO" FROM table_76251 WHERE "Country" = 'denmark' AND "IATA" = 'bll' | wikisql |
CREATE TABLE table_name_5 (
dainty_june VARCHAR,
louise VARCHAR
) | Who was Dainty June when Tammy Blanchard was Louise? | SELECT dainty_june FROM table_name_5 WHERE louise = "tammy blanchard" | sql_create_context |
CREATE TABLE table_52639 (
"Date" text,
"Competition" text,
"Venue" text,
"Result" text,
"Score" text,
"Goals" text
) | Which competition was at wilderspool? | SELECT "Competition" FROM table_52639 WHERE "Venue" = 'wilderspool' | wikisql |
CREATE TABLE table_38701 (
"Stage" text,
"Stage winner" text,
"General classification" text,
"Points classification" text,
"Mountains classification" text,
"Malaysian rider classification" text,
"Team classification" text
) | Which stage had tabriz petrochemical team in the team classification? | SELECT "Stage" FROM table_38701 WHERE "Team classification" = 'tabriz petrochemical team' | wikisql |
CREATE TABLE Third_Party_Companies (
company_id INTEGER,
company_type VARCHAR(5),
company_name VARCHAR(255),
company_address VARCHAR(255),
other_company_details VARCHAR(255)
)
CREATE TABLE Engineer_Visits (
engineer_visit_id INTEGER,
contact_staff_id INTEGER,
engineer_id INTEGER,
fa... | List the number of enginners in a stacked bar chart. The x-axis is first name and group by skill description. | SELECT first_name, COUNT(first_name) FROM Maintenance_Engineers AS T1 JOIN Engineer_Skills AS T2 ON T1.engineer_id = T2.engineer_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id GROUP BY skill_description, first_name | 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 diagnoses (
... | how many patients whose gender is f and death status is 0? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.expire_flag = "0" | mimicsql_data |
CREATE TABLE head (
head_ID int,
name text,
born_state text,
age real
)
CREATE TABLE management (
department_ID int,
head_ID int,
temporary_acting text
)
CREATE TABLE department (
Department_ID int,
Name text,
Creation text,
Ranking int,
Budget_in_Billions real,
Num... | Show sum of budget in different year and group by department creation time with a line chart. | SELECT Creation, SUM(Budget_in_Billions) FROM department GROUP BY Creation | 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 demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob te... | how many patients whose diagnoses icd9 code is 43411 and drug type is additive? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "43411" AND prescriptions.drug_type = "ADDITIVE" | mimicsql_data |
CREATE TABLE table_25923164_1 (
original_air_date VARCHAR,
written_by VARCHAR
) | What was the original air date of the episode written by amanda segel? | SELECT original_air_date FROM table_25923164_1 WHERE written_by = "Amanda Segel" | sql_create_context |
CREATE TABLE member (
Name VARCHAR,
Member_ID VARCHAR
)
CREATE TABLE round (
Member_ID VARCHAR
) | Show the names of members in ascending order of their rank in rounds. | SELECT T1.Name FROM member AS T1 JOIN round AS T2 ON T1.Member_ID = T2.Member_ID ORDER BY Rank_in_Round | 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 procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE diagnoses (
... | count the number of patients who have stayed in the hospital for more than 23 days with a drug phenylephrine hcl. | SELECT prescriptions.drug_dose FROM prescriptions WHERE prescriptions.drug = "Phenytoin" | mimicsql_data |
CREATE TABLE Customers_cards (
customer_id VARCHAR
) | Show all customer ids and the number of cards owned by each customer. | SELECT customer_id, COUNT(*) FROM Customers_cards GROUP BY customer_id | sql_create_context |
CREATE TABLE table_50729 (
"Driver" text,
"Team" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
) | What were the highest laps when the grid was larger than 19 and the time/retired was fuel? | SELECT MAX("Laps") FROM table_50729 WHERE "Grid" > '19' AND "Time/Retired" = 'fuel' | 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... | 自二零零二年一月十日开始,截止到二零一四年九月十日,患者张修真通过医疗机构7718159开的西药总数有多少 | 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 '2002-01-10' AND '2014-09-10' AND t_kc21.MED_SER_ORG_NO = '7718159' AND t_kc22.MED_INV_ITEM... | css |
CREATE TABLE area (
course_id int,
area varchar
)
CREATE TABLE program (
program_id int,
name varchar,
college varchar,
introduction varchar
)
CREATE TABLE ta (
campus_job_id int,
student_id int,
location varchar
)
CREATE TABLE course (
course_id int,
name varchar,
dep... | For graduating as CS major what ROMLANG classes do I need to take ? | SELECT DISTINCT course.department, course.name, course.number FROM program_course INNER JOIN course ON program_course.course_id = course.course_id WHERE course.department = 'ROMLANG' | advising |
CREATE TABLE table_6093 (
"Model Number" text,
"Stepping" text,
"Frequency" text,
"L2 Cache" text,
"Multi 1" text,
"V Core" text,
"Socket" text,
"Release Date" text,
"Part Number(s)" text
) | What is the v-core for a stepping of G1 and frequency of 1900MHz? | SELECT "V Core" FROM table_6093 WHERE "Stepping" = 'g1' AND "Frequency" = '1900mhz' | wikisql |
CREATE TABLE transfers (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
eventtype text,
careunit text,
wardid number,
intime time,
outtime time
)
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
... | number of times patient 9983 has received a trnsplnt live rel donor procedure during their last hospital visit. | SELECT COUNT(*) FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'trnsplnt live rel donor') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 9983 AND NOT admissions.dis... | mimic_iii |
CREATE TABLE table_23876 (
"#" text,
"Date" text,
"at/vs." text,
"Opponent" text,
"Score" text,
"Attendance" real,
"Record" text
) | Who did they play against in game 7? | SELECT "Opponent" FROM table_23876 WHERE "#" = '7' | wikisql |
CREATE TABLE table_64680 (
"Outcome" text,
"Year" text,
"Tournament" text,
"Surface" text,
"Opponent in the final" text,
"Score" text
) | What year had a score of 6 7(5), 2 6 and opponent of Brenda Schultz-Mccarthy? | SELECT "Year" FROM table_64680 WHERE "Opponent in the final" = 'brenda schultz-mccarthy' AND "Score" = '6–7(5), 2–6' | wikisql |
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 EN... | Scatterplot of minimal stu gpa vs avg(stu gpa) by DEPT_CODE | SELECT AVG(STU_GPA), MIN(STU_GPA) FROM STUDENT GROUP BY DEPT_CODE | nvbench |
CREATE TABLE equipment_sequence (
aircraft_code_sequence varchar,
aircraft_code varchar
)
CREATE TABLE ground_service (
city_code text,
airport_code text,
transport_type text,
ground_fare int
)
CREATE TABLE flight_stop (
flight_id int,
stop_number int,
stop_days text,
stop_airp... | list all flights on CO from DENVER to CHICAGO which depart after 2134 | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'CHICAGO' AND flight.departure_time > 2134 AND flight.to_airport = AIRPORT_SERVICE_1.airp... | atis |
CREATE TABLE table_name_96 (
score VARCHAR,
money___$__ VARCHAR,
player VARCHAR
) | WHAT IS THE SCORE WITH $85 FOR CLARENCE HACKNEY? | SELECT score FROM table_name_96 WHERE money___$__ = 85 AND player = "clarence hackney" | sql_create_context |
CREATE TABLE chartevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime t... | how much patient 19175 weighs in 11/this year for the first time? | 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 = 19175)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit wt'... | mimic_iii |
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 transfers (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
eventtype tex... | what are the five most commonly used procedures for patients who were previously diagnosed with chr blood loss anemia within the same hospital visit during the last year? | SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_i... | mimic_iii |
CREATE TABLE table_25016824_2 (
eliminated VARCHAR,
vote VARCHAR
) | Who was eliminated when the vote was 8-1? | SELECT eliminated FROM table_25016824_2 WHERE vote = "8-1" | sql_create_context |
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | what is the number of patients whose days of hospital stay is greater than 4 and drug type is main? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "4" AND prescriptions.drug_type = "MAIN" | mimicsql_data |
CREATE TABLE table_46852 (
"Position" real,
"Team" text,
"Played" real,
"Drawn" real,
"Lost" real,
"Goals For" real,
"Goals Against" real,
"Goal Difference" text,
"Points 1" text
) | What is the position when the points 1 is 61? | SELECT SUM("Position") FROM table_46852 WHERE "Points 1" = '61' | wikisql |
CREATE TABLE Badges (
Id number,
UserId number,
Name text,
Date time,
Class number,
TagBased boolean
)
CREATE TABLE PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number,
LinkTypeId number
)
CREATE TABLE PostHistoryTypes (
Id number,
Name tex... | Find My answers based on tag. | SELECT pt.Name, pt.Id, p.Title, p.Tags, p.Id FROM Posts AS p INNER JOIN Users AS u ON u.Id = p.OwnerUserId INNER JOIN PostTypes AS pt ON pt.Id = p.PostTypeId WHERE u.Id = '##UserId##' | sede |
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... | 72214494患者在03年7月26日到2015年4月29日之内买了几次西药? | 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_ID = '72214494' AND t_kc22.STA_DATE BETWEEN '2003-07-26' AND '2015-04-29' AND t_kc22.MED_INV_ITEM_TYPE = '西药费' | css |
CREATE TABLE table_67388 (
"Position" text,
"Number" real,
"Name" text,
"Class" text,
"Injury (Status)" text,
"Last Update" text
) | for the name of jamar jackson what is the total of Number? | SELECT COUNT("Number") FROM table_67388 WHERE "Name" = 'jamar jackson' | wikisql |
CREATE TABLE table_name_13 (
_number___county VARCHAR,
mascot VARCHAR,
ihsaa_class VARCHAR,
enrollment VARCHAR
) | what is the #/county that is ihsaa class aaa, has enrollment higher than 611 and the dragons is the mascot? | SELECT _number___county FROM table_name_13 WHERE ihsaa_class = "aaa" AND enrollment > 611 AND mascot = "dragons" | sql_create_context |
CREATE TABLE table_23215145_2 (
team VARCHAR
) | If the team is Worcester, what is the 2005-2006 points? | SELECT 2005 AS _06_points FROM table_23215145_2 WHERE team = "Worcester" | sql_create_context |
CREATE TABLE table_78103 (
"Date" text,
"Winning Team" text,
"Losing Team" text,
"Score" text,
"Venue" text
) | on June 14, what was the winning score by the Devil rays in pro player stadium? | SELECT "Score" FROM table_78103 WHERE "Venue" = 'pro player stadium' AND "Winning Team" = 'devil rays' AND "Date" = 'june 14' | wikisql |
CREATE TABLE table_name_96 (
white VARCHAR,
amerindian VARCHAR
) | WHich Category in White has a Amerindian of 4,87%? | SELECT white FROM table_name_96 WHERE amerindian = "4,87%" | sql_create_context |
CREATE TABLE table_name_49 (
name VARCHAR,
goals VARCHAR
) | Which name had 6 goals? | SELECT name FROM table_name_49 WHERE goals = 6 | sql_create_context |
CREATE TABLE table_18974269_1 (
player VARCHAR,
original_season VARCHAR,
eliminated VARCHAR
) | Who was the contestant eliminated on episode 8 of RW: Key West season? | SELECT player FROM table_18974269_1 WHERE original_season = "RW: Key West" AND eliminated = "Episode 8" | sql_create_context |
CREATE TABLE jobs (
job_id text,
job_title text,
min_salary number,
max_salary number
)
CREATE TABLE countries (
country_id text,
country_name text,
region_id number
)
CREATE TABLE locations (
location_id number,
street_address text,
postal_code text,
city text,
state_p... | Return the phone numbers of employees with salaries between 8000 and 12000. | SELECT phone_number FROM employees WHERE salary BETWEEN 8000 AND 12000 | spider |
CREATE TABLE table_12257 (
"Pick" real,
"Player" text,
"Team" text,
"Position" text,
"Year" real
) | What is the average year of the montreal expos? | SELECT AVG("Year") FROM table_12257 WHERE "Team" = 'montreal expos' | wikisql |
CREATE TABLE files (
f_id VARCHAR,
duration VARCHAR
) | What is the id of the longest song? | SELECT f_id FROM files ORDER BY duration DESC LIMIT 1 | sql_create_context |
CREATE TABLE table_1047 (
"Player" text,
"Position" text,
"Starter" text,
"Touchdowns" real,
"Extra points" real,
"Field goals" real,
"Points" real
) | Name the number of players when starter is no and touchdowns is 1 for right halfback | SELECT COUNT("Player") FROM table_1047 WHERE "Starter" = 'No' AND "Touchdowns" = '1' AND "Position" = 'Right halfback' | wikisql |
CREATE TABLE table_8972 (
"Name" text,
"Seat" text,
"Population (2011)" real,
"Area (km 2 )" real,
"Density (inhabitants/km 2 )" real
) | What is the area (in km2) for theewaterskloof, whose population in 2011 was less than 108,790? | SELECT SUM("Area (km 2 )") FROM table_8972 WHERE "Name" = 'theewaterskloof' AND "Population (2011)" < '108,790' | wikisql |
CREATE TABLE person_info (
CSD text,
CSRQ time,
GJDM text,
GJMC text,
JGDM text,
JGMC text,
MZDM text,
MZMC text,
RYBH text,
XBDM number,
XBMC text,
XLDM text,
XLMC text,
XM text,
ZYLBDM text,
ZYMC text
)
CREATE TABLE zyjzjlb (
CYBQDM text,
CYBQMC... | 门诊诊断患者为慢性胃溃疡的抗环瓜氨酸肽抗体数值的平均值是多少?最值是多少? | SELECT AVG(jyjgzbb.JCZBJGDL), MIN(jyjgzbb.JCZBJGDL), MAX(jyjgzbb.JCZBJGDL) FROM mzjzjlb JOIN jybgb JOIN jyjgzbb ON mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE mzjzjlb.JZZDSM = '慢性胃溃疡' AND jyjgzbb.JCZBMC = '抗环瓜氨酸肽抗体' | css |
CREATE TABLE table_58262 (
"Driver" text,
"Constructor" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
) | How many grids have a Time/Retired of gearbox, and Laps smaller than 3? | SELECT COUNT("Grid") FROM table_58262 WHERE "Time/Retired" = 'gearbox' AND "Laps" < '3' | wikisql |
CREATE TABLE mission (
mission_id number,
ship_id number,
code text,
launched_year number,
location text,
speed_knots number,
fate text
)
CREATE TABLE ship (
ship_id number,
name text,
type text,
nationality text,
tonnage number
) | What are the types of the ships that have both shiips with tonnage more than 6000 and those with tonnage less than 4000? | SELECT type FROM ship WHERE tonnage > 6000 INTERSECT SELECT type FROM ship WHERE tonnage < 4000 | spider |
CREATE TABLE table_64370 (
"Rank" real,
"Athletes" text,
"Country" text,
"Time" text,
"Notes" text
) | What is the time for Cuba, with a notes entry of QS? | SELECT "Time" FROM table_64370 WHERE "Notes" = 'qs' AND "Country" = 'cuba' | wikisql |
CREATE TABLE table_28068063_3 (
eliminated_from_competition VARCHAR,
proceed_to_quarter_final VARCHAR
) | Who was eliminated from the competition when connacht to the quarter final? | SELECT eliminated_from_competition FROM table_28068063_3 WHERE proceed_to_quarter_final = "Connacht" | sql_create_context |
CREATE TABLE table_52062 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
) | Name the score for november 16 | SELECT "Score" FROM table_52062 WHERE "Date" = 'november 16' | wikisql |
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 text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
C... | what is the number of patients whose year of birth is less than 2098 and item id is 51032? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2098" AND lab.itemid = "51032" | mimicsql_data |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime t... | what drug was patient 033-4763 prescribed for during the same hospital visit after undergoing sedative agent - diazepam? | SELECT t2.drugname FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid =... | eicu |
CREATE TABLE table_51173 (
"Season" text,
"Races" real,
"Podiums" real,
"Pole" real,
"FLaps" real
) | WHAT ARE THE RACES FOR 2010 WITH FLAPS LARGER THAN 6? | SELECT MAX("Races") FROM table_51173 WHERE "Season" = '2010' AND "FLaps" > '6' | wikisql |
CREATE TABLE table_53258 (
"Player" text,
"Car." real,
"Yards" text,
"Avg." text,
"Long" real
) | Who has the highest Long with 59 Car? | SELECT MAX("Long") FROM table_53258 WHERE "Car." = '59' | wikisql |
CREATE TABLE table_57071 (
"Grand Prix" text,
"Date" text,
"Location" text,
"Pole Position" text,
"Fastest Lap" text,
"Winning Driver" text,
"Constructor" text,
"Report" text
) | What is the report for the race that Ayrton Senna won on 27 August? | SELECT "Report" FROM table_57071 WHERE "Winning Driver" = 'ayrton senna' AND "Date" = '27 august' | wikisql |
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 SuggestedEdits (
Id number,
PostId number,
CreationD... | List of Users in a given location and keyword contained in 'about me'. This query lists all users in a given location and keyword sorted by reputation.
Enter 'Germany' or 'Deutschland' in the location field.
Enter 'Java' in the keyword field.
Press 'Run Query'
credits to https://data.stackexchange.com/meta.s... | SELECT Id AS "user_link", Location, WebsiteUrl, Reputation FROM Users WHERE LOWER(Location) LIKE LOWER('%##location##%') AND LOWER(AboutMe) LIKE LOWER('%##keyword##%') ORDER BY Reputation DESC | sede |
CREATE TABLE table_4744 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What venue featured the away side scoring 16.20 (116)? | SELECT "Venue" FROM table_4744 WHERE "Away team score" = '16.20 (116)' | wikisql |
CREATE TABLE table_name_53 (
sensor VARCHAR,
sensor_resolution VARCHAR,
camera VARCHAR
) | What was the sensor with a resolution of 355x288 for a Naturalpoint Trackir 3? | SELECT sensor FROM table_name_53 WHERE sensor_resolution = "355x288" AND camera = "naturalpoint trackir 3" | sql_create_context |
CREATE TABLE player (
POSITION VARCHAR
) | how many different positions are there? | SELECT COUNT(DISTINCT POSITION) FROM player | sql_create_context |
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... | how many days has it been since the last time patient 006-202970 has received administration of saline solution during this hospital visit? | SELECT 1 * (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 = '006-202970... | eicu |
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... | how many patients with copd exacerbation underwent the procedure with short title allo hem stem ct w/o pur? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "COPD EXACERBATION" AND procedures.short_title = "Allo hem stem ct w/o pur" | mimicsql_data |
CREATE TABLE table_60762 (
"Official Name" text,
"Status" text,
"Area km 2" real,
"Population" real,
"Census Ranking" text
) | How large, in square kilometers, is Sackville? | SELECT "Area km 2" FROM table_60762 WHERE "Official Name" = 'sackville' | wikisql |
CREATE TABLE table_2076608_1 (
accreditation VARCHAR,
school VARCHAR
) | What accreditation does Hollins University have? | SELECT accreditation FROM table_2076608_1 WHERE school = "Hollins University" | sql_create_context |
CREATE TABLE table_name_41 (
date VARCHAR,
venue VARCHAR,
opponent VARCHAR
) | What was the date of the match at venue A with the celtic as the opponent? | SELECT date FROM table_name_41 WHERE venue = "a" AND opponent = "celtic" | sql_create_context |
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,... | 药品603623-l患者花淑华在哪几家医院被开出过? | SELECT MED_SER_ORG_NO FROM t_kc21 WHERE PERSON_NM = '花淑华' AND MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc22 WHERE SOC_SRT_DIRE_CD = '603623-l') | css |
CREATE TABLE Allergy_type (
allergytype VARCHAR
) | Which allergy type has most number of allergies? | SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY COUNT(*) DESC LIMIT 1 | sql_create_context |
CREATE TABLE table_53834 (
"Year" text,
"Winner" text,
"Jockey" text,
"Trainer" text,
"Owner" text,
"Distance" text,
"Time" text,
"Purse" text
) | Who was the owner of the trainer Steve Klesaris? | SELECT "Owner" FROM table_53834 WHERE "Trainer" = 'steve klesaris' | wikisql |
CREATE TABLE airline (
airline_code varchar,
airline_name text,
note text
)
CREATE TABLE aircraft (
aircraft_code varchar,
aircraft_description varchar,
manufacturer varchar,
basic_type varchar,
engines int,
propulsion varchar,
wide_body varchar,
wing_span int,
length in... | show me the flights from PHILADELPHIA to DALLAS with a stop in ATLANTA | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' AND CITY_2.cit... | atis |
CREATE TABLE table_50682 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text,
"Money ( $ )" real
) | Which Player has a Score of 74-67-74-71=286? | SELECT "Player" FROM table_50682 WHERE "Score" = '74-67-74-71=286' | wikisql |
CREATE TABLE table_name_67 (
nba_draft VARCHAR,
height VARCHAR
) | What is the NBA draft result of the player with a height of 6-7? | SELECT nba_draft FROM table_name_67 WHERE height = "6-7" | sql_create_context |
CREATE TABLE people (
People_ID int,
Name text,
Height real,
Weight real,
Date_of_Birth text
)
CREATE TABLE entrepreneur (
Entrepreneur_ID int,
People_ID int,
Company text,
Money_Requested real,
Investor text
) | A line chart for what are the number of the dates of birth of entrepreneurs with investor 'Simon Woodroffe' or 'Peter Jones'?, sort by the Date_of_Birth in desc. | SELECT Date_of_Birth, COUNT(Date_of_Birth) FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Investor = "Simon Woodroffe" OR T1.Investor = "Peter Jones" ORDER BY Date_of_Birth DESC | 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... | give the number of patients whose admission type is urgent and lab test name is potassium, whole blood. | 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.label = "Potassium, Whole Blood" | mimicsql_data |
CREATE TABLE table_26847237_3 (
location VARCHAR,
opposition VARCHAR
) | What is the location when the opposition is mid canterbury? | SELECT location FROM table_26847237_3 WHERE opposition = "Mid Canterbury" | sql_create_context |
CREATE TABLE table_38790 (
"Round" text,
"Player" text,
"Position" text,
"Nationality" text,
"College/Junior/Club Team (League)" text
) | In what Round is John Parco a Center? | SELECT "Round" FROM table_38790 WHERE "Position" = 'center' AND "Player" = 'john parco' | wikisql |
CREATE TABLE PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number,
LinkTypeId number
)
CREATE TABLE SuggestedEdits (
Id number,
PostId number,
CreationDate time,
ApprovalDate time,
RejectionDate time,
OwnerUserId number,
Comment text,
Text te... | Average tag statistics with answers. Views, Score and Answers per Tag (with answers) | WITH Questions AS (SELECT AVG(CAST(q.Score AS FLOAT)) AS score FROM Posts AS q INNER JOIN PostTags AS pt ON q.Id = pt.PostId INNER JOIN Tags AS t ON t.Id = pt.TagId WHERE q.PostTypeId = 1 AND t.TagName = '##tagname##') SELECT * FROM Questions AS q | sede |
CREATE TABLE PostTags (
PostId number,
TagId number
)
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE Tags (
Id number,
TagName text,
Count number,
ExcerptPostId number,
WikiPostId number
)
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId n... | Histogram of time to first answer. | SELECT hours_to_first_answer, COUNT(*) AS answer_count FROM (SELECT qId, MIN(hours_to_answer) AS hours_to_first_answer FROM (SELECT questions.Id AS qId, questions.CreationDate AS qCreationDate, answers.Id AS aId, answers.CreationDate AS aCreationDate, CAST((JULIANDAY(CreationDate) - JULIANDAY(questions.CreationDate)) *... | sede |
CREATE TABLE procedures_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 m... | in this month, has patient 18866's heart rate been ever less than 88.0? | SELECT COUNT(*) > 0 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 = 18866)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'heart rate' AND d... | mimic_iii |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.