context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE Reservations (
Code INTEGER,
Room TEXT,
CheckIn TEXT,
CheckOut TEXT,
Rate REAL,
LastName TEXT,
FirstName TEXT,
Adults INTEGER,
Kids INTEGER
)
CREATE TABLE Rooms (
RoomId TEXT,
roomName TEXT,
beds INTEGER,
bedType TEXT,
maxOccupancy INTEGER,
baseP... | how many rooms have king beds? Report the number for each decor type, and could you order by the y-axis from high to low please? | SELECT decor, COUNT(*) FROM Rooms WHERE bedType = "King" GROUP BY decor ORDER BY COUNT(*) 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 admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,... | find the top five most commonly prescribed drugs for patients 30s since 6 years ago? | SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN 30 AND 39) AND DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-6 year') GROUP BY pres... | mimic_iii |
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 number of male patients were diagnosed with anemia in chronic kidney disease? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "M" AND diagnoses.long_title = "Anemia in chronic kidney disease" | mimicsql_data |
CREATE TABLE table_48340 (
"Year" real,
"MLB Club" text,
"Record" text,
"Finish" text,
"Manager" text
) | what is the finish when the manager is tom kotchman and the record is 40-36? | SELECT "Finish" FROM table_48340 WHERE "Manager" = 'tom kotchman' AND "Record" = '40-36' | wikisql |
CREATE TABLE table_34374 (
"Place" real,
"Nation" text,
"6 Ropes" real,
"4 Hoops, 2 Clubs" real,
"Total" real
) | What is the total of Greece, which is placed below 8? | SELECT COUNT("Total") FROM table_34374 WHERE "Nation" = 'greece' AND "Place" > '8' | wikisql |
CREATE TABLE table_23399481_4 (
title VARCHAR,
us_viewers__in_millions_ VARCHAR
) | What are the titles of the episodes which had 1.10 million U.S. viewers? | SELECT title FROM table_23399481_4 WHERE us_viewers__in_millions_ = "1.10" | sql_create_context |
CREATE TABLE table_name_29 (
college VARCHAR,
player VARCHAR
) | Where did Dennis Byrd go to college? | SELECT college FROM table_name_29 WHERE player = "dennis byrd" | sql_create_context |
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 ReviewTaskResults (
Id number,
ReviewTaskId number,
... | Tag score with (and without) Accepted Bonus. | SELECT Tags.TagName, SUM(Posts.Score) AS score, COUNT(posts2.AcceptedAnswerId) AS accepted, SUM(Posts.Score) + COUNT(posts2.AcceptedAnswerId) AS both, ROUND(COUNT(posts2.AcceptedAnswerId) * 100.0 / NULLIF(SUM(Posts.Score), 0), 0) AS "%" FROM Posts INNER JOIN Posts AS posts2 ON Posts.ParentId = posts2.Id INNER JOIN Post... | sede |
CREATE TABLE table_29139 (
"Team" text,
"Outgoing manager" text,
"Manner of departure" text,
"Date of vacancy" text,
"Incoming manager" text,
"Date of appointment" text,
"Position in Table" text
) | What is the position in table when the date of vacancy was 4 january 2011? | SELECT "Position in Table" FROM table_29139 WHERE "Date of vacancy" = '4 January 2011' | wikisql |
CREATE TABLE table_name_56 (
matches INTEGER,
prize_money VARCHAR
) | What is the average for matches with a prize money amount of 3,000? | SELECT AVG(matches) FROM table_name_56 WHERE prize_money = "£3,000" | sql_create_context |
CREATE TABLE table_42502 (
"Date" text,
"at/vs." text,
"Opponent'" text,
"Score'" text,
"Attendance" real,
"Record" text
) | What was the Opponent on February 6, 1988? | SELECT "Opponent'" FROM table_42502 WHERE "Date" = 'february 6, 1988' | wikisql |
CREATE TABLE table_name_7 (
venue VARCHAR,
player VARCHAR
) | What venue has don bradman (nsw) as the player? | SELECT venue FROM table_name_7 WHERE player = "don bradman (nsw)" | sql_create_context |
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE icustays (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
first_careunit text,
last_careunit text,
first_wardid number,
last_wardid number,
intime time,
outtime ti... | what is the marital status of patient 9519 in their last hospital visit. | SELECT admissions.marital_status FROM admissions WHERE admissions.subject_id = 9519 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1 | mimic_iii |
CREATE TABLE zyjzjlb (
CYBQDM text,
CYBQMC text,
CYCWH text,
CYKSDM text,
CYKSMC text,
CYSJ time,
CYZTDM number,
HZXM text,
JZKSDM text,
JZKSMC text,
JZLSH text,
KH text,
KLX number,
MZBMLX number,
MZJZLSH text,
MZZDBM text,
MZZDMC text,
MZZYZDZZBM... | 把患者吕莉莉在二零零三年十二月二日到二零一三年八月十七日被开出的所有检验报告单的科室编码以及名称列出来 | SELECT jybgb.KSBM, jybgb.KSMC FROM person_info JOIN hz_info JOIN txmzjzjlb JOIN jybgb ON person_info.RYBH = hz_info.RYBH AND 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 WHERE person_... | css |
CREATE TABLE table_73890 (
"No. in series" real,
"No. in season" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text
) | name the title of the episode that ed sherin directed. | SELECT "Title" FROM table_73890 WHERE "Directed by" = 'Ed Sherin' | wikisql |
CREATE TABLE chartevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
enddate time... | what is the difference between the total amount of inputs and outputs of patient 14671 today? | SELECT (SELECT SUM(inputevents_cv.amount) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 14671)) AND DATETIME(inputevents_cv.charttime, 'start of day') = DATETIME(CURRENT_... | mimic_iii |
CREATE TABLE employees (
hire_date INTEGER
) | display all the details from Employees table for those employees who was hired before 2002-06-21. | SELECT * FROM employees WHERE hire_date < '2002-06-21' | sql_create_context |
CREATE TABLE table_7766 (
"Date" text,
"Tournament" text,
"Surface" text,
"Opponent in final" text,
"Score in final" text
) | Who is the opponent in the final of the tournament on May 22, 2006? | SELECT "Opponent in final" FROM table_7766 WHERE "Date" = 'may 22, 2006' | wikisql |
CREATE TABLE machine (
Machine_ID int,
Making_Year int,
Class text,
Team text,
Machine_series text,
value_points real,
quality_rank int
)
CREATE TABLE repair_assignment (
technician_id int,
repair_ID int,
Machine_ID int
)
CREATE TABLE repair (
repair_ID int,
name text,
... | For each team, how many technicians are there, and order Y in ascending order. | SELECT Team, COUNT(*) FROM technician GROUP BY Team ORDER BY COUNT(*) | nvbench |
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 prescriptions... | provide me the number of white-russian patients who have replaced route of drug administration. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND prescriptions.route = "REPLACE" | mimicsql_data |
CREATE TABLE table_54020 (
"Rank" real,
"Name" text,
"Film" text,
"Year" text,
"Date of Birth" text,
"Date of Award" text
) | What year was 7th heaven made? | SELECT "Year" FROM table_54020 WHERE "Film" = '7th heaven' | wikisql |
CREATE TABLE table_66561 (
"Season" text,
"Games" text,
"Lost" text,
"Tied" text,
"Points" text,
"Goals for" text,
"Goals against" text,
"Standing" text
) | What's the season that had a lost of 9 with 72 games? | SELECT "Season" FROM table_66561 WHERE "Games" = '72' AND "Lost" = '9' | wikisql |
CREATE TABLE time_interval (
period text,
begin_time int,
end_time int
)
CREATE TABLE flight_stop (
flight_id int,
stop_number int,
stop_days text,
stop_airport text,
arrival_time int,
arrival_airline text,
arrival_flight_number int,
departure_time int,
departure_airline... | what're the cheapest nonstop flights from NEW YORK to MIAMI one way | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE ((CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'NEW YORK' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY... | atis |
CREATE TABLE table_36590 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" real
) | Name the opponent on november 22, 1942 | SELECT "Opponent" FROM table_36590 WHERE "Date" = 'november 22, 1942' | wikisql |
CREATE TABLE program_course (
program_id int,
course_id int,
workload int,
category varchar
)
CREATE TABLE comment_instructor (
instructor_id int,
student_id int,
score int,
comment_text varchar
)
CREATE TABLE program_requirement (
program_id int,
category varchar,
min_cred... | Are there any AEROSP classes that meet on days other than Friday ? | SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE course_offering.friday = 'N' AND course.department = 'AEROSP' AND semester.semester = 'WN' AND... | advising |
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 DE... | How many courses for each teacher? Show me a stacked bar chart The x-axis is teacher's first name and group by course description, list in descending by the y-axis please. | SELECT EMP_FNAME, COUNT(EMP_FNAME) FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM JOIN COURSE AS T3 ON T1.CRS_CODE = T3.CRS_CODE JOIN PROFESSOR AS T4 ON T2.EMP_NUM = T4.EMP_NUM GROUP BY CRS_DESCRIPTION, EMP_FNAME ORDER BY COUNT(EMP_FNAME) DESC | nvbench |
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 wdmzjzjlb (
HXPLC number,
HZX... | 从二0一六年十二月八日到二0二0年十二月二十九日,患者79918177的所有检验结果指标记录中的检测方法共有多少种,给全部列出来 | SELECT jyjgzbb.JCFF FROM hz_info JOIN wdmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX AND wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH... | css |
CREATE TABLE products (
product_id number,
product_type_code text,
product_name text,
product_price number
)
CREATE TABLE order_items (
order_item_id number,
order_id number,
product_id number
)
CREATE TABLE addresses (
address_id number,
address_details text
)
CREATE TABLE depart... | Return the id of the department with the fewest staff assignments. | SELECT department_id FROM staff_department_assignments GROUP BY department_id ORDER BY COUNT(*) LIMIT 1 | spider |
CREATE TABLE table_name_92 (
gold VARCHAR,
bronze VARCHAR,
total VARCHAR
) | How many golds were there when there was more than 11 bronze and 29 in total? | SELECT COUNT(gold) FROM table_name_92 WHERE bronze > 11 AND total = 29 | sql_create_context |
CREATE TABLE table_name_73 (
opponent VARCHAR,
result VARCHAR
) | What was the Opponent during the game with a Result of W 37-21? | SELECT opponent FROM table_name_73 WHERE result = "w 37-21" | sql_create_context |
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... | 患者60851064612进行医疗就诊对应的住院或门诊流水号是什么? | SELECT CLINIC_ID FROM t_kc24 WHERE MED_CLINIC_ID = '60851064612' | css |
CREATE TABLE table_name_19 (
name VARCHAR,
pick__number VARCHAR
) | What is the Name of draft Pick #10? | SELECT name FROM table_name_19 WHERE pick__number = 10 | sql_create_context |
CREATE TABLE table_9148 (
"Date" text,
"Time" text,
"Score" text,
"Set 1" text,
"Set 2" text,
"Set 3" text,
"Total" text
) | On what date was the score for set 3 22 25? | SELECT "Date" FROM table_9148 WHERE "Set 3" = '22–25' | wikisql |
CREATE TABLE table_61281 (
"Player" text,
"Team" text,
"Matches" real,
"Inns" real,
"Runs" real,
"Balls" real,
"S/Rate" real,
"100s" real,
"Average" real
) | How many Matches have an S/Rate smaller than 133.72, and a Team of yorkshire carnegie? | SELECT COUNT("Matches") FROM table_61281 WHERE "S/Rate" < '133.72' AND "Team" = 'yorkshire carnegie' | 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 demographic ... | how many patients whose religion is christian scientist and lab test name is reticulocyte count, manual? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.religion = "CHRISTIAN SCIENTIST" AND lab.label = "Reticulocyte Count, Manual" | mimicsql_data |
CREATE TABLE table_6109 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Game site" text,
"Attendance" text
) | Name the opponent for week of 2 | SELECT "Opponent" FROM table_6109 WHERE "Week" = '2' | wikisql |
CREATE TABLE zyjzjlb (
CYBQDM text,
CYBQMC text,
CYCWH text,
CYKSDM text,
CYKSMC text,
CYSJ time,
CYZTDM number,
HZXM text,
JZKSDM text,
JZKSMC text,
JZLSH text,
KH text,
KLX number,
MZBMLX number,
MZJZLSH text,
MZZDBM text,
MZZDMC text,
MZZYZDZZBM... | 过去患者48404711在有哪些门诊诊断? | SELECT mzjzjlb.JZZDBM, mzjzjlb.JZZDSM FROM hz_info JOIN mzjzjlb JOIN person_info_hz_info JOIN person_info ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND person_info_hz_info.KH = hz_info.KH AND person_info_hz_info.KLX = hz_info.KLX AND person_info_hz_info.YLJGDM = hz_inf... | css |
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 (
... | among patients who had initial insertion of single-chamber device, rate responsive, calculate the number of those belonging to american indian/alaska native origin | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND procedures.long_title = "Initial insertion of single-chamber device, rate responsive" | mimicsql_data |
CREATE TABLE table_name_64 (
crowd INTEGER,
away_team VARCHAR
) | What was the largest crowd where Carlton was the away team? | SELECT MAX(crowd) FROM table_name_64 WHERE away_team = "carlton" | sql_create_context |
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
value number
)
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_type t... | how did patient 6940 first visit since 2104 to the hospital? | SELECT admissions.admission_type FROM admissions WHERE admissions.subject_id = 6940 AND STRFTIME('%y', admissions.admittime) >= '2104' ORDER BY admissions.admittime LIMIT 1 | mimic_iii |
CREATE TABLE table_1140074_2 (
race VARCHAR,
rnd VARCHAR
) | what's the total number of race winner with rnd being 10 | SELECT COUNT(race) AS Winner FROM table_1140074_2 WHERE rnd = 10 | 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... | provide the number of patients whose age is less than 51 and drug route is pb? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "51" AND prescriptions.route = "PB" | mimicsql_data |
CREATE TABLE table_204_70 (
id number,
"pick #" number,
"nfl team" text,
"player" text,
"position" text,
"college" text
) | if david williams was chosen 208th overall , and greg schaum was chosen 186th , how many picks separate the two ? | SELECT (SELECT "pick #" FROM table_204_70 WHERE "player" = 'david williams') - (SELECT "pick #" FROM table_204_70 WHERE "player" = 'greg schaum') | squall |
CREATE TABLE table_name_75 (
interactivity_support VARCHAR,
format VARCHAR
) | Which Interactivity support has a Format of fictionbook? | SELECT interactivity_support FROM table_name_75 WHERE format = "fictionbook" | sql_create_context |
CREATE TABLE table_name_94 (
date VARCHAR,
lot_no VARCHAR,
boiler_type VARCHAR,
built_at VARCHAR
) | What year is the date when the boiler type is forward topfeed, the built at is Crewe, and lot number is less than 187? | SELECT COUNT(date) FROM table_name_94 WHERE boiler_type = "forward topfeed" AND built_at = "crewe" AND lot_no < 187 | sql_create_context |
CREATE TABLE table_23007 (
"Team" text,
"Games" real,
"Wins" real,
"Losses" real,
"Ties" real,
"Win Pct." text,
"Playoff berths" real,
"Division titles" real,
"Postseason record" text,
"Super Bowl record" text
) | What is the minimum losses for the Kansas City Chiefs? | SELECT MIN("Losses") FROM table_23007 WHERE "Team" = 'Kansas City Chiefs' | wikisql |
CREATE TABLE event (
ID int,
Name text,
Stadium_ID int,
Year text
)
CREATE TABLE record (
ID int,
Result text,
Swimmer_ID int,
Event_ID int
)
CREATE TABLE stadium (
ID int,
name text,
Capacity int,
City text,
Country text,
Opening_year int
)
CREATE TABLE swimme... | Show me about the distribution of meter_400 and ID in a bar chart, and could you order in descending by the y-axis? | SELECT meter_400, ID FROM swimmer ORDER BY ID DESC | nvbench |
CREATE TABLE table_name_27 (
opponent VARCHAR,
record VARCHAR
) | Who is the opponent when the record is 17-19-4? | SELECT opponent FROM table_name_27 WHERE record = "17-19-4" | sql_create_context |
CREATE TABLE table_58940 (
"Player" text,
"Height" real,
"Position" text,
"Year born (Age)" text,
"Current Club" text
) | Who has a height of 2.16? | SELECT "Player" FROM table_58940 WHERE "Height" = '2.16' | wikisql |
CREATE TABLE table_33080 (
"sliding tackle" text,
"spear tackle" text,
"dump tackle" text,
"body tackle" text,
"ankle tap" text,
"diving tackle" text,
"bumping/blocking" text,
"shoulder charge" text,
"steal/intercept ball" text,
"Chicken wing" text
) | Which Chicken wing has no steal/intercept ball? | SELECT "Chicken wing" FROM table_33080 WHERE "steal/intercept ball" = 'no' | 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... | Provide the number of patients who were ordered to get a vancomycin lab test and are still alive. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.expire_flag = "0" AND lab.label = "Vancomycin" | mimicsql_data |
CREATE TABLE fare_basis (
fare_basis_code text,
booking_class text,
class_type text,
premium text,
economy text,
discounted text,
night text,
season text,
basis_days text
)
CREATE TABLE food_service (
meal_code text,
meal_number int,
compartment text,
meal_descriptio... | list the total number of flights between all airports by DL | SELECT COUNT(DISTINCT flight_id) FROM flight WHERE airline_code = 'DL' | atis |
CREATE TABLE table_69311 (
"Name" text,
"Gender" text,
"Area" text,
"Authority" text,
"Decile" real,
"Roll" real
) | Which name has an Area of makarewa? | SELECT "Name" FROM table_69311 WHERE "Area" = 'makarewa' | wikisql |
CREATE TABLE table_13332 (
"Date" text,
"Course" text,
"Distance" text,
"Type" text,
"Winner" text
) | Which date was a rest day? | SELECT "Date" FROM table_13332 WHERE "Course" = 'rest day' | wikisql |
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE chartevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABL... | what is the name of the procedure that was given two or more times to patient 27362? | SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, COUNT(procedures_icd.charttime) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 273... | mimic_iii |
CREATE TABLE table_203_399 (
id number,
"pos." text,
"driver" text,
"co-driver" text,
"car" text,
"time" text,
"difference" text,
"points" number
) | what is the total amount of times a suzuki sx4 wrc car was used ? | SELECT COUNT(*) FROM table_203_399 WHERE "car" = 'suzuki sx4 wrc' | squall |
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... | 在2007-10-12到2017-03-18内患者范华池曾在医院有多少次就诊? | SELECT (SELECT COUNT(*) FROM person_info JOIN hz_info JOIN wdmzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX WHERE person_info.XM = '范华池' AND wdmzjzjlb.JZKSRQ BETWEEN '2007-10-12' AND '2017-03-18' UNION SELECT COUNT(*) FROM p... | css |
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE transfers (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
eventtype text,
careunit text,
wardid number,
intime time,
... | tell me the name of the drug that was last prescribed to patient 12938 in 03/2104 via tp route? | SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 12938) AND prescriptions.route = 'tp' AND STRFTIME('%y-%m', prescriptions.startdate) = '2104-03' ORDER BY prescriptions.startdate DESC LIMIT 1 | mimic_iii |
CREATE TABLE table_24983 (
"Year" text,
"Chairman" text,
"Artistic Director" text,
"Performance Liaison" text,
"Secretary" text,
"Business manager" text,
"Production Stagemanager" text,
"Dramaturge" text,
"Public Relations" text,
"First/Second Year Rep." text,
"Male Rep." tex... | Who were the performance liaisons for the dramaturge Chrisena Ricci? | SELECT "Performance Liaison" FROM table_24983 WHERE "Dramaturge" = 'Chrisena Ricci' | wikisql |
CREATE TABLE cost (
row_id number,
subject_id number,
hadm_id number,
event_type text,
event_id number,
chargetime time,
cost number
)
CREATE TABLE chartevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
itemid number,
charttime time,
v... | how many days has it been since patient 49176 first potassium chl 20 meq / 1000 ml d5ns was prescribed in the current hospital encounter? | SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', prescriptions.startdate)) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 49176 AND admissions.dischtime IS NULL) AND prescriptions.drug = 'potassium chl 20 meq / 1000 ml d5ns' ORDER BY... | mimic_iii |
CREATE TABLE table_30802 (
"Year" text,
"Position" real,
"Games played" real,
"Won" real,
"Tied" real,
"Lost" real,
"Goals Scored" real,
"Goals Against" real,
"Points" real,
"Postseason place" text
) | What is the goals against listed when the goals scored is 30? | SELECT "Goals Against" FROM table_30802 WHERE "Goals Scored" = '30' | wikisql |
CREATE TABLE table_17121262_9 (
high_assists VARCHAR,
date VARCHAR
) | Who had the highest assists on March 18? | SELECT high_assists FROM table_17121262_9 WHERE date = "March 18" | sql_create_context |
CREATE TABLE table_79140 (
"Pick #" real,
"Player" text,
"Nationality" text,
"Position" text,
"Team from" text,
"League from" text
) | What is the total pick # for the D position from a team from Chilliwack Bruins? | SELECT SUM("Pick #") FROM table_79140 WHERE "Position" = 'd' AND "Team from" = 'chilliwack bruins' | wikisql |
CREATE TABLE table_36572 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Record" text
) | Can you tell me the Record that has the Home of detroit, and the Visitor of phoenix? | SELECT "Record" FROM table_36572 WHERE "Home" = 'detroit' AND "Visitor" = 'phoenix' | wikisql |
CREATE TABLE table_13869651_3 (
ht VARCHAR,
model_number VARCHAR
) | What is the HT value of threw Athlon x2 5200b model? | SELECT ht FROM table_13869651_3 WHERE model_number = "Athlon X2 5200B" | sql_create_context |
CREATE TABLE table_train_22 (
"id" int,
"pre_treatment_with_hydroxyethyl_starch" int,
"requiring_dialysis" bool,
"intracerebral_hemorrhage" bool,
"serum_creatinine" float,
"kidney_disease" bool,
"allergy_to_hydroxyethyl_starch" bool,
"age" float,
"NOUSE" float
) | known allergy against hydroxyethyl starch | SELECT * FROM table_train_22 WHERE allergy_to_hydroxyethyl_starch = 1 | criteria2sql |
CREATE TABLE table_204_741 (
id number,
"rank" number,
"name" text,
"nationality" text,
"1,62" text,
"1,67" text,
"1,72" text,
"1,75" text,
"notes" text
) | what was the number of competitors who qualified in group a ? | SELECT COUNT("name") FROM table_204_741 | squall |
CREATE TABLE table_23609 (
"Year" real,
"Author(s) or Editor(s)" text,
"Book Title" text,
"Publisher" text,
"Category" text,
"Result" text
) | Which year is the book title the ordinary? | SELECT "Year" FROM table_23609 WHERE "Book Title" = 'The Ordinary' | wikisql |
CREATE TABLE table_67638 (
"Episode" text,
"First aired" text,
"Entrepreneur(s)" text,
"Company or product name" text,
"Money requested (\u00a3)" text,
"Investing Dragon(s)" text
) | Which Entrepreneur(s) first aired on 24 August 2006? | SELECT "Entrepreneur(s)" FROM table_67638 WHERE "First aired" = '24 august 2006' | wikisql |
CREATE TABLE table_11667521_17 (
stage__winner_ VARCHAR,
general_classification VARCHAR
) | IN WHAT STAGE DID ALEXANDER VINOKOUROV WON THE GENERAL CLASSIFICATION? | SELECT stage__winner_ FROM table_11667521_17 WHERE general_classification = "Alexander Vinokourov" | sql_create_context |
CREATE TABLE table_44424 (
"Total" real,
"Score" text,
"Winning Team" text,
"Losing Team" text,
"Venue" text,
"Date" text
) | Which venue had a losing team of south sydney rabbitohs? | SELECT "Venue" FROM table_44424 WHERE "Losing Team" = 'south sydney rabbitohs' | wikisql |
CREATE TABLE table_43286 (
"Ship" text,
"Hull No." text,
"Commissioned" text,
"Builder" text,
"Home Port" text,
"NVR Page" text
) | What is the Commissioned date of the ship in NVR Page MCM02? | SELECT "Commissioned" FROM table_43286 WHERE "NVR Page" = 'mcm02' | wikisql |
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
value number
)
CREATE TABLE prescriptions (
... | during the last year, how many patients had been diagnosed with depress psychosis-unspec during the same month after the previous diagnosis of pseudomonal pneumonia? | SELECT COUNT(DISTINCT t1.subject_id) 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 d_icd_diagnoses.short_title = 'depress psychosis-... | mimic_iii |
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 whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, draw a bar chart about the distribution of job_id and the average of employee_id , and group by attribute job_id, show X-axis from high to low order. | SELECT JOB_ID, AVG(EMPLOYEE_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_13599 (
"Municipality" text,
"Inhabitants" real,
"Mayor" text,
"Party" text,
"Election" real
) | What is livorno's average election? | SELECT AVG("Election") FROM table_13599 WHERE "Municipality" = 'livorno' | wikisql |
CREATE TABLE table_name_39 (
round INTEGER,
position VARCHAR,
pick__number VARCHAR
) | What is the mean round number for center position when the pick number is less than 23? | SELECT AVG(round) FROM table_name_39 WHERE position = "center" AND pick__number < 23 | sql_create_context |
CREATE TABLE table_name_31 (
nature_of_help VARCHAR,
people_assisted VARCHAR
) | In the disaster in which 1,000 people were helped, what was the nature of help? | SELECT nature_of_help FROM table_name_31 WHERE people_assisted = "1,000" | sql_create_context |
CREATE TABLE t_kc21 (
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,
... | 在03-3-18到04-1-26内,患者吕问筠被开出的哪些药品,把所有药品的编码、名称、数量、单价、金额列出来 | SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM, t_kc22.QTY, t_kc22.UNIVALENT, t_kc22.AMOUNT 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_kc21.IN_HOSP_DATE BETWEEN '200... | css |
CREATE TABLE Customers (
customer_id INTEGER,
customer_first_name VARCHAR(20),
customer_last_name VARCHAR(20),
customer_address VARCHAR(255),
customer_phone VARCHAR(255),
customer_email VARCHAR(255),
other_customer_details VARCHAR(255)
)
CREATE TABLE Accounts (
account_id INTEGER,
c... | what are the different card types, and how many transactions have been made with each?, and sort X from high to low order. | SELECT card_type_code, COUNT(*) FROM Financial_Transactions AS T1 JOIN Customers_Cards AS T2 ON T1.card_id = T2.card_id GROUP BY T2.card_type_code ORDER BY card_type_code DESC | nvbench |
CREATE TABLE table_16054 (
"Camp" text,
"Estimated deaths" text,
"Operational" text,
"Occupied territory" text,
"Current country of location" text,
"Primary means for mass killings" text
) | what's the operational period with camp sajmi te | SELECT "Operational" FROM table_16054 WHERE "Camp" = 'Sajmište' | wikisql |
CREATE TABLE table_69741 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Record" text
) | What is the Record on april 13? | SELECT "Record" FROM table_69741 WHERE "Date" = 'april 13' | wikisql |
CREATE TABLE table_75676 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Game site" text,
"Attendance" text
) | What's the result of the game against Bye? | SELECT "Result" FROM table_75676 WHERE "Opponent" = 'bye' | wikisql |
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 (
... | how much is the average total cost of a hospital that involves a drug called amiodarone 900 mg in 500 ml d5w since 3 years ago? | SELECT AVG(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'amiodarone 900 mg in 500 ml d5w')) AND DATETIM... | eicu |
CREATE TABLE table_45052 (
"Season" text,
"Races" real,
"Wins" real,
"Podiums" real,
"Poles" real,
"Fastest Laps" real
) | What is the total number of races when there was more than 1 pole, and the fastest number of laps was less than 4? | SELECT SUM("Races") FROM table_45052 WHERE "Poles" > '1' AND "Fastest Laps" < '4' | wikisql |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
ic... | what was the name of the drug, which patient 030-10559 was prescribed within the same day after being diagnosed with cabg < 7days the last 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 = '030-10559') AND diagnosis.diagnos... | eicu |
CREATE TABLE table_name_72 (
ethernet_port_count VARCHAR,
model VARCHAR
) | What is the Ethernet port count of the whr-hp-g300n model? | SELECT ethernet_port_count FROM table_name_72 WHERE model = "whr-hp-g300n" | sql_create_context |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE demographic ... | provide the number of patients whose primary disease is abdominal abscess and year of death is less than or equal to 2112? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "ABDOMINAL ABSCESS" AND demographic.dod_year <= "2112.0" | mimicsql_data |
CREATE TABLE table_name_72 (
avg_g VARCHAR,
yards VARCHAR,
long VARCHAR,
gp_gs VARCHAR
) | What is the total number of avg/g with a long of 50, a gp-gs of 3-0, and 926 yards? | SELECT COUNT(avg_g) FROM table_name_72 WHERE long = 50 AND gp_gs = "3-0" AND yards > 926 | sql_create_context |
CREATE TABLE table_39613 (
"Value" text,
"Color" text,
"Obverse" text,
"Reverse" text,
"First issued" real
) | How much was a Reverse of guitar of agust n p o barrios before 1998? | SELECT "Value" FROM table_39613 WHERE "First issued" < '1998' AND "Reverse" = 'guitar of agustín pío barrios' | wikisql |
CREATE TABLE table_26454128_9 (
rank INTEGER,
distance__metres_ VARCHAR
) | What is the highest rank where the distance is 52.73? | SELECT MAX(rank) FROM table_26454128_9 WHERE distance__metres_ = "52.73" | sql_create_context |
CREATE TABLE Person (
name varchar(20),
age INTEGER,
city TEXT,
gender TEXT,
job TEXT
)
CREATE TABLE PersonFriend (
name varchar(20),
friend varchar(20),
year INTEGER
) | Draw a bar chart for how many people are under 40 for each gender?, order by the gender from low to high. | SELECT gender, COUNT(*) FROM Person WHERE age < 40 GROUP BY gender ORDER BY gender | nvbench |
CREATE TABLE icustays (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
first_careunit text,
last_careunit text,
first_wardid number,
last_wardid number,
intime time,
outtime time
)
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
... | what were the top three most frequent diagnosis that patients received within the same month after they were diagnosed with bacteremia during a year before? | SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.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 FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions... | mimic_iii |
CREATE TABLE table_name_92 (
coronie VARCHAR,
nickerie VARCHAR
) | What is the coronie with a 0.7% nickerie? | SELECT coronie FROM table_name_92 WHERE nickerie = "0.7%" | sql_create_context |
CREATE TABLE program_course (
program_id int,
course_id int,
workload int,
category varchar
)
CREATE TABLE comment_instructor (
instructor_id int,
student_id int,
score int,
comment_text varchar
)
CREATE TABLE course_offering (
offering_id int,
course_id int,
semester int,
... | What ULCS courses do I need to take for the EECS major ? | SELECT DISTINCT course.department, course.name, course.number FROM course, program_course WHERE course.department LIKE '%EECS%' AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id | advising |
CREATE TABLE table_21130 (
"Election" real,
"Candidates fielded" real,
"# of seats won" real,
"Total votes" real,
"% of popular vote" text,
"Place" text
) | What is the largest number of seats won? | SELECT MAX("# of seats won") FROM table_21130 | wikisql |
CREATE TABLE Organisations (
organisation_id VARCHAR,
organisation_details VARCHAR
)
CREATE TABLE Grants (
organisation_id VARCHAR,
grant_amount INTEGER
) | Find the organisation ids and details of the organisations which are involved in | SELECT T2.organisation_id, T2.organisation_details FROM Grants AS T1 JOIN Organisations AS T2 ON T1.organisation_id = T2.organisation_id GROUP BY T2.organisation_id HAVING SUM(T1.grant_amount) > 6000 | sql_create_context |
CREATE TABLE table_61861 (
"Pick" real,
"Player" text,
"Team" text,
"Position" text,
"Hometown/School" text
) | WHAT IS THE TEAM WITH AN OF POSITION AND PICK OF 24? | SELECT "Team" FROM table_61861 WHERE "Position" = 'of' AND "Pick" = '24' | 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,
... | has patient 022-6959 been prescribed versed, 1000 ml flex cont : sodium chloride 0.9 % iv soln, or aspirin chew tab 81 mg in 12/2105? | SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-6959')) AND medication.drugname IN ('1000 ml flex cont : sodium chlori... | eicu |
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 (
... | what is admission type and procedure short title of subject id 2560? | SELECT demographic.admission_type, procedures.short_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "2560" | mimicsql_data |
CREATE TABLE table_test_31 (
"id" int,
"ejection_fraction_ef" int,
"macular_disease" bool,
"systemic" bool,
"alt" float,
"iud" bool,
"condom_with_spermicide" bool,
"gender" string,
"meropenem" bool,
"non_q_wave_myocardial_infarction" bool,
"hbcab" bool,
"unstable_angina" ... | 2 out of 3 of the following criteria were essential in order to classify a patient as poor ovarian responder: advanced maternal age ( >= 40 years ) or any other risk factor for poor ovarian response; a poor ovarian response ( <= 3 oocytes with a conventional stimulation protocol ) ; an abnormal ovarian reserve test ( a... | SELECT * FROM table_test_31 WHERE poor_ovarian_responder = 1 OR (CASE WHEN advanced_maternal_age = 1 OR age >= 40 THEN 1 ELSE 0 END + CASE WHEN risk_factor = 1 AND ovarian_response = 1 THEN 1 ELSE 0 END + CASE WHEN oocytes <= 3 THEN 1 ELSE 0 END + CASE WHEN ovarian_reserve_test = 1 OR afc < 7 THEN 1 ELSE 0 END) >= 2 | criteria2sql |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.