context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number... | when was the first time when patient 99647 had the minimum value of mch on this hospital encounter? | SELECT labevents.charttime FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 99647 AND admissions.dischtime IS NULL) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'mch') ORDER BY labevents.valuenum, labevents.c... | mimic_iii |
CREATE TABLE table_12584173_1 (
population__glengallan_ INTEGER
) | What is the maximum population size in the town of Glengallen? | SELECT MAX(population__glengallan_) FROM table_12584173_1 | sql_create_context |
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title 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... | what was the new prescription for patient 97395 today compared to the prescription yesterday? | SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 97395) AND DATETIME(prescriptions.startdate, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT prescriptions.drug FROM prescriptions WHERE... | mimic_iii |
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
value number
)
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
CREATE TABLE procedures_icd (
r... | how many days had it been since patient 76372 received her first acetaminophen prescription in the current hospital visit? | 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 = 76372 AND admissions.dischtime IS NULL) AND prescriptions.drug = 'acetaminophen' ORDER BY prescriptions.startda... | mimic_iii |
CREATE TABLE program_course (
program_id int,
course_id int,
workload int,
category varchar
)
CREATE TABLE jobs (
job_id int,
job_title varchar,
description varchar,
requirement varchar,
city varchar,
state varchar,
country varchar,
zip int
)
CREATE TABLE course (
c... | What is the time slot for next semester 's MATH 107 lectures ? | SELECT DISTINCT course_offering.start_time FROM course INNER JOIN program_course ON program_course.course_id = course.course_id INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE course.department = 'MATH' AND course.nu... | advising |
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 inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttim... | what was the first value of the temperature c (calc) of patient 15447 today? | 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 = 15447)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'temperatu... | mimic_iii |
CREATE TABLE table_28039032_1 (
round VARCHAR,
winners_from_previous_round VARCHAR
) | What was the round when there were 16 winners from the previous round? | SELECT round FROM table_28039032_1 WHERE winners_from_previous_round = "16" | sql_create_context |
CREATE TABLE table_2044 (
"No." real,
"Date" text,
"Tournament" text,
"Winning score" text,
"To par" text,
"Margin of victory" text,
"Runner(s)-up" text,
"Winners share ( $ )" real
) | What was the winning score in the tournament, ending with Birdie Kim as a runner-up? | SELECT "Winning score" FROM table_2044 WHERE "Runner(s)-up" = 'Birdie Kim' | wikisql |
CREATE TABLE table_40901 (
"Rank" real,
"Nation" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
) | What is the most gold where silver is 0? | SELECT MAX("Gold") FROM table_40901 WHERE "Silver" < '0' | wikisql |
CREATE TABLE table_19008 (
"Year (Ceremony)" text,
"Film title used in nomination" text,
"Original title" text,
"Director" text,
"Result" text
) | Whatis the original title for lion's den? | SELECT "Original title" FROM table_19008 WHERE "Film title used in nomination" = 'Lion''s Den' | wikisql |
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREAT... | what is the daily average chloride value for patient 011-31779 during this month? | SELECT AVG(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 = '011-31779')) AND lab.labname = 'chloride' AND DATETIME(lab.labresulttime, 'start o... | eicu |
CREATE TABLE table_28422 (
"No." real,
"Title" text,
"Directed by" text,
"Written by" text,
"U.S. viewers (million)" text,
"Rank (week)" real,
"Original air date" text,
"Production code" text
) | What is the weeks rank for the episode with the production code 1alf05? | SELECT MAX("Rank (week)") FROM table_28422 WHERE "Production code" = '1ALF05' | wikisql |
CREATE TABLE table_name_81 (
squad_no INTEGER,
goals INTEGER
) | What was the lowest squad with 0 goals? | SELECT MIN(squad_no) FROM table_name_81 WHERE goals < 0 | sql_create_context |
CREATE TABLE Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER
)
CREATE TABLE SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1)
)
CREATE TABLE Student (
StuID INTEGER,
LName VARCHAR(12),
Fn... | Visualize a bar chart for how many students play each sport? | SELECT SportName, COUNT(*) FROM SportsInfo GROUP BY SportName | nvbench |
CREATE TABLE bank (
branch_id number,
bname text,
no_of_customers number,
city text,
state text
)
CREATE TABLE loan (
loan_id text,
loan_type text,
cust_id text,
branch_id text,
amount number
)
CREATE TABLE customer (
cust_id text,
cust_name text,
acc_type text,
... | List the name of all different customers who have some loan sorted by their total loan amount. | SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name ORDER BY SUM(T2.amount) | spider |
CREATE TABLE table_18151 (
"District" text,
"Incumbent" text,
"Party" text,
"First elected" real,
"Results" text,
"Candidates" text
) | What is the party of the district incumbent Jim Saxton? | SELECT "Party" FROM table_18151 WHERE "Incumbent" = 'Jim Saxton' | wikisql |
CREATE TABLE table_73887 (
"\u00d7" text,
"Faisaly" text,
"Wehdat" text,
"Ramtha" text,
"Ahli" text,
"Jazeera" text,
"Hussein" text,
"Amman" text,
"Orthodoxy" text,
"Jeel" text,
"Ain Karem" text
) | What is orthodoxy when x is wehdat? | SELECT "Orthodoxy" FROM table_73887 WHERE "\u00d7" = 'Wehdat' | wikisql |
CREATE TABLE table_13373 (
"Position" text,
"Name" text,
"Party" text,
"First Election" text,
"District" text
) | What District has a Member with a First Election date of 1985? | SELECT "District" FROM table_13373 WHERE "Position" = 'member' AND "First Election" = '1985' | wikisql |
CREATE TABLE table_3606 (
"District" text,
"Incumbent" text,
"Party" text,
"First elected" text,
"Result" text,
"Candidates" text
) | In district North Carolina 10, what are the candidates? | SELECT "Candidates" FROM table_3606 WHERE "District" = 'North Carolina 10' | wikisql |
CREATE TABLE table_66536 (
"World record" text,
"Snatch" text,
"Oksana Slivenko ( RUS )" text,
"123kg" text,
"Santo Domingo , Dominican" text
) | What's the 123kg of the Total world record? | SELECT "123kg" FROM table_66536 WHERE "World record" = 'total' | wikisql |
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 is the average total cost of the hospital that includes the laboratory crp test the previous year? | 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 lab.patientunitstayid FROM lab WHERE lab.labname = 'crp')) AND DATETIME(cost.chargetime, 'start of year') = DATETIME(CUR... | eicu |
CREATE TABLE table_name_37 (
attendance VARCHAR,
date VARCHAR
) | How many Attendances on 13 april 1903? | SELECT attendance FROM table_name_37 WHERE date = "13 april 1903" | sql_create_context |
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_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 text,
careunit text,
... | when patient 27599 has left the hospital the last time? | SELECT admissions.dischtime FROM admissions WHERE admissions.subject_id = 27599 ORDER BY admissions.dischtime DESC LIMIT 1 | mimic_iii |
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... | For each room, find its the number of times reservations were made for it Visualize them using a bar chart, I want to sort by the X in asc please. | SELECT Room, COUNT(*) FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room ORDER BY Room | nvbench |
CREATE TABLE table_26375386_16 (
judges INTEGER,
couple VARCHAR
) | What was the lowest judge rank for danny and frankie? | SELECT MIN(judges) FROM table_26375386_16 WHERE couple = "Danny and Frankie" | sql_create_context |
CREATE TABLE table_72517 (
"School" text,
"Winners" real,
"Finalists" real,
"Total Finals" real,
"Year of last win" text
) | How many times was banbridge academy the winner? | SELECT COUNT("Winners") FROM table_72517 WHERE "School" = 'Banbridge Academy' | wikisql |
CREATE TABLE table_204_853 (
id number,
"pos" number,
"grid" number,
"no." number,
"driver" text,
"team" text,
"manufacturer" text,
"laps" number,
"points" number
) | how many drivers did not have a top ten position ? | SELECT COUNT("driver") FROM table_204_853 WHERE "pos" > 10 | squall |
CREATE TABLE table_14060 (
"Position" real,
"Team" text,
"Played" real,
"Wins" real,
"Draws" real,
"Losses" real,
"Scored" real,
"Conceded" real,
"Points" real
) | What is the fewest draws for teams having under 2 losses, more than 4 wins, and a position under 4? | SELECT MIN("Draws") FROM table_14060 WHERE "Losses" < '2' AND "Position" < '4' AND "Wins" > '4' | wikisql |
CREATE TABLE Comments (
Id number,
PostId number,
Score number,
Text text,
CreationDate time,
UserDisplayName text,
UserId number,
ContentLicense text
)
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,... | Does setting a bounty get good answers?. | SELECT Votes.VoteTypeId, Votes.PostId, Votes.UserId, Votes.CreationDate, Votes.BountyAmount FROM Votes INNER JOIN Posts AS q ON q.Id = Votes.PostId WHERE q.CreationDate >= '2011-05-11 00:00:00' AND (Votes.VoteTypeId = 8 OR Votes.VoteTypeId = 9) AND Votes.PostId = 7375 | sede |
CREATE TABLE table_8227 (
"Position" real,
"Name" text,
"Played" real,
"Drawn" real,
"Lost" real,
"Points" real
) | What is the whole of Drawn that has a Lost of 4? | SELECT SUM("Drawn") FROM table_8227 WHERE "Lost" = '4' | wikisql |
CREATE TABLE table_name_5 (
constructor VARCHAR,
laps VARCHAR,
driver VARCHAR
) | Which constructor had a laps number bigger than 3 when the driver was Jarno Trulli? | SELECT constructor FROM table_name_5 WHERE laps > 3 AND driver = "jarno trulli" | sql_create_context |
CREATE TABLE compartment_class (
compartment varchar,
class_type varchar
)
CREATE TABLE flight_leg (
flight_id int,
leg_number int,
leg_flight int
)
CREATE TABLE dual_carrier (
main_airline varchar,
low_flight_number int,
high_flight_number int,
dual_airline varchar,
service_na... | show me flights monday night after 2000 for DALLAS to BOSTON | 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, date_day, days, flight WHERE ((date_day.day_number = 21 AND date_day.month_number = 2 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.departure_time... | atis |
CREATE TABLE table_name_84 (
date VARCHAR,
attendance VARCHAR
) | What date had 51,265 attendance? | SELECT date FROM table_name_84 WHERE attendance = "51,265" | sql_create_context |
CREATE TABLE table_445 (
"Year" real,
"Mens singles" text,
"Womens singles" text,
"Mens doubles" text,
"Womens doubles" text,
"Mixed doubles" text
) | What are the mixed doubles where the mens singles is kim brodersen? | SELECT "Mixed doubles" FROM table_445 WHERE "Mens singles" = 'Kim Brodersen' | wikisql |
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... | how many patients below 83 years of age are diagnosed with single ib in-hosp w cs? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "83" AND diagnoses.short_title = "Single lb in-hosp w cs" | mimicsql_data |
CREATE TABLE t_kc24 (
MED_SAFE_PAY_ID text,
OVERALL_CD_ORG text,
OVERALL_CD_PERSON text,
MED_CLINIC_ID text,
REF_SLT_FLG number,
CLINIC_SLT_DATE time,
COMP_ID text,
PERSON_ID text,
FLX_MED_ORG_ID text,
INSU_TYPE text,
MED_AMOUT number,
PER_ACC_PAY number,
OVE_PAY numb... | 患者孙永安被开出的药品均不超过6580.96元在哪几次医疗记录中?列出有哪些医疗就诊编号? | SELECT MED_CLINIC_ID FROM t_kc21 WHERE PERSON_NM = '孙永安' AND NOT MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc22 WHERE AMOUNT > 6580.96) | css |
CREATE TABLE table_39392 (
"Region" text,
"Date" text,
"Label" text,
"Format" text,
"Catalogue" text
) | In what Region was the Catalogue number 1785089 released? | SELECT "Region" FROM table_39392 WHERE "Catalogue" = '1785089' | 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 diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions... | what is minimum age of patients whose gender is f and age is greater than or equal to 83? | SELECT MIN(demographic.age) FROM demographic WHERE demographic.gender = "F" AND demographic.age >= "83" | mimicsql_data |
CREATE TABLE Organisation_Types (
organisation_type VARCHAR(10),
organisation_type_description VARCHAR(255)
)
CREATE TABLE Document_Types (
document_type_code VARCHAR(10),
document_description VARCHAR(255)
)
CREATE TABLE Documents (
document_id INTEGER,
document_type_code VARCHAR(10),
gran... | Display a bar chart for what are the ids and details for all organizations that have grants of more than 6000 dollars?, and display in descending by the x-axis. | SELECT T2.organisation_details, T1.organisation_id FROM Grants AS T1 JOIN Organisations AS T2 ON T1.organisation_id = T2.organisation_id GROUP BY T2.organisation_details ORDER BY T2.organisation_details DESC | nvbench |
CREATE TABLE table_name_58 (
region VARCHAR,
year VARCHAR,
name VARCHAR
) | Name the region before 2008 when name of best 1200 | SELECT region FROM table_name_58 WHERE year < 2008 AND name = "best 1200" | sql_create_context |
CREATE TABLE table_2016 (
"Pos" real,
"No" real,
"Driver" text,
"Constructor" text,
"Q1 order" real,
"Q1 time" text,
"Q1 pos" real,
"Q1+Q2 time" text
) | when q1 pos is 8 what is the q1+q2 time? | SELECT "Q1+Q2 time" FROM table_2016 WHERE "Q1 pos" = '8' | wikisql |
CREATE TABLE table_name_25 (
gold INTEGER,
total VARCHAR,
bronze VARCHAR,
silver VARCHAR
) | What is the largest number of gold medals when the bronze medals is less than 49, and there is 22 silver medals, and the total is less than 60? | SELECT MAX(gold) FROM table_name_25 WHERE bronze < 49 AND silver = 22 AND total < 60 | sql_create_context |
CREATE TABLE table_name_79 (
city VARCHAR,
rank VARCHAR,
airport VARCHAR
) | What city is ranked greater than 6, and the airport is St. Petersburg/Clearwater (PIE) | SELECT city FROM table_name_79 WHERE rank > 6 AND airport = "st. petersburg/clearwater (pie)" | sql_create_context |
CREATE TABLE table_417 (
"Symbol" text,
"Description" text,
"Success" text,
"Date of completion" text,
"Deadline for completion" text
) | what's the date of completion where success is yes | SELECT "Date of completion" FROM table_417 WHERE "Success" = 'Yes' | 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 course_offering (
offering_id int,
course_id int,
semester int,
... | The course listings have included POLISH 621 for how long ? | SELECT DISTINCT semester.year FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'POLISH' AND course.number = 621 AND semester.semester_id = course_offering.semester ORDER BY semester.year LIMIT 1 | advising |
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 ... | 病患奚白云所有检验报告单中时间在09年9月21日到12年11月3日内的审核日期时间都是什么时候? | SELECT jybgb.SHSJ FROM person_info JOIN hz_info JOIN mzjzjlb JOIN 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 = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE person_info.XM = '奚白云' AND jybg... | css |
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,
... | does patient 017-36245 have any diagnosis of a disease until 2104? | SELECT COUNT(*) > 0 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-36245')) AND STRFTIME('%y', diagnosis.diagnosistime) <= '2104' | eicu |
CREATE TABLE t_kc21_t_kc22 (
MED_CLINIC_ID text,
MED_EXP_DET_ID number
)
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,
C... | 郎永逸患者在编号为7422800的这家医院中被开过什么单价最高的药?还需要这个药的编码,还有药品的单价 | SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM, t_kc22.UNIVALENT FROM t_kc22 WHERE t_kc21_t_kc22.MED_CLINIC_ID IN (SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_NM = '郎永逸' AND t_kc21.MED_SER_ORG_NO = '7422800') ORDER BY t_kc22.UNIVALENT DESC LIMIT 1 | css |
CREATE TABLE table_30454 (
"Player" text,
"Cap(s)" real,
"Goal(s)" real,
"International Debut" text,
"Club(s)" text
) | When tommy smith category:articles with hcards is the player and 1 is the goal how many cap(s) are there? | SELECT COUNT("Cap(s)") FROM table_30454 WHERE "Goal(s)" = '1' AND "Player" = 'Tommy Smith Category:Articles with hCards' | 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... | 9581134这家医院所有的就诊记载里,按照不一样的科室编号与入院时的诊断编码差别算一下民政补助部分与总医疗费用的最大比值并把结果按降序来排列 | SELECT gwyjzb.MED_ORG_DEPT_CD, gwyjzb.IN_DIAG_DIS_NM, MAX(t_kc24.CIVIL_SUBSIDY) FROM gwyjzb JOIN t_kc24 ON gwyjzb.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE gwyjzb.MED_SER_ORG_NO = '9581134' GROUP BY gwyjzb.MED_ORG_DEPT_CD, gwyjzb.IN_DIAG_DIS_NM ORDER BY MAX(t_kc24.CIVIL_SUBSIDY / t_kc24.MED_AMOUT) DESC UNION SELECT fg... | css |
CREATE TABLE mzb (
CLINIC_ID 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,
INSU_TYPE text,
IN... | 53464739这名患者做过哪些检查了 | SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM qtb JOIN t_kc22 ON qtb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE qtb.PERSON_ID = '53464739' AND t_kc22.MED_INV_ITEM_TYPE = '检查费' UNION SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM gyb JOIN t_kc22 ON gyb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE ... | css |
CREATE TABLE table_name_48 (
country VARCHAR,
city VARCHAR
) | Which country is Wellington located in? | SELECT country FROM table_name_48 WHERE city = "wellington" | sql_create_context |
CREATE TABLE zzmzjzjlb (
HXPLC number,
HZXM text,
JLSJ time,
JZJSSJ time,
JZKSBM text,
JZKSMC text,
JZKSRQ time,
JZLSH number,
JZZDBM text,
JZZDSM text,
JZZTDM number,
JZZTMC text,
KH text,
KLX number,
MJZH text,
ML number,
MZZYZDZZBM text,
MZZYZDZ... | 在2010年5月30日到2014年3月23日内患者08033471有多少检测结果指标记录的检验人为88248924的检测指标流水号? | SELECT jyjgzbb.JYZBLSH FROM hz_info JOIN zzmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX AND zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.B... | css |
CREATE TABLE table_name_78 (
home VARCHAR,
date VARCHAR,
decision VARCHAR,
visitor VARCHAR
) | What was the home team in the February 22 game that Legace played in for the St. Louis Blues? | SELECT home FROM table_name_78 WHERE decision = "legace" AND visitor = "st. louis" AND date = "february 22" | sql_create_context |
CREATE TABLE table_name_30 (
points_difference VARCHAR,
lost VARCHAR,
points VARCHAR
) | What is the points difference for a loss less than 6, and points less than 11? | SELECT points_difference FROM table_name_30 WHERE lost < 6 AND points < 11 | 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 number of patients with elective admission type had a lab test for wbc? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND lab.label = "WBC" | mimicsql_data |
CREATE TABLE table_name_86 (
home VARCHAR,
date VARCHAR
) | Date of march 30 involves what home? | SELECT home FROM table_name_86 WHERE date = "march 30" | sql_create_context |
CREATE TABLE table_name_8 (
date VARCHAR,
record VARCHAR
) | What is the Date of the game when the Record is 32 31 6? | SELECT date FROM table_name_8 WHERE record = "32–31–6" | 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 demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
... | what is maximum days of hospital stay of patients whose year of birth is greater than 2049? | SELECT MAX(demographic.days_stay) FROM demographic WHERE demographic.dob_year > "2049" | mimicsql_data |
CREATE TABLE table_name_69 (
laps INTEGER,
grid VARCHAR
) | What is the average number of laps for grid 8? | SELECT AVG(laps) FROM table_name_69 WHERE grid = 8 | sql_create_context |
CREATE TABLE table_34869 (
"Team" text,
"Average" real,
"Points" real,
"Played" real,
"1989-90" text,
"1990-91" text,
"1991-1992" real
) | Which team has a 1990-91 number of 39 and a 1989-90 number of 34? | SELECT "Team" FROM table_34869 WHERE "1990-91" = '39' AND "1989-90" = '34' | wikisql |
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,
... | tell me the sex of patient 24330. | SELECT patients.gender FROM patients WHERE patients.subject_id = 24330 | mimic_iii |
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
) | A bar chart about what are the average prices of products, grouped by manufacturer name?, order from low to high by the y-axis. | SELECT T2.Name, AVG(T1.Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY AVG(T1.Price) | nvbench |
CREATE TABLE table_203_759 (
id number,
"year" number,
"company" text,
"number of members affected" number,
"duration of strike" text,
"notes" text
) | how many strikes had above 200,000 members affected ? | SELECT COUNT(*) FROM table_203_759 WHERE "number of members affected" > 200000 | squall |
CREATE TABLE table_50863 (
"Tournament" text,
"Surface" text,
"Week" text,
"Winner" text,
"Finalist" text,
"Semifinalists" text
) | Which finalist has Semifinalists of andre agassi (1) lleyton hewitt (14)? | SELECT "Finalist" FROM table_50863 WHERE "Semifinalists" = 'andre agassi (1) lleyton hewitt (14)' | 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... | how many users total, lastYear, last2months and last month. | SELECT COUNT(1), MIN(CreationDate), MAX(CreationDate) FROM Posts WHERE CreationDate <= '2019-01-11' AND Tags LIKE '%microservices%' | sede |
CREATE TABLE table_42855 (
"Team" text,
"Match" real,
"Points" real,
"Draw" real,
"Lost" real
) | What is the average draw that has a lost less than 4, gwardia bydgoszcz as the team, with a match greater than 5? | SELECT AVG("Draw") FROM table_42855 WHERE "Lost" < '4' AND "Team" = 'gwardia bydgoszcz' AND "Match" > '5' | wikisql |
CREATE TABLE table_name_1 (
loss INTEGER,
long INTEGER
) | What is the highest loss with a long more than 61? | SELECT MAX(loss) FROM table_name_1 WHERE long > 61 | sql_create_context |
CREATE TABLE table_name_36 (
clean_ VARCHAR,
_jerk VARCHAR,
bodyweight VARCHAR,
total__kg_ VARCHAR
) | What is the Clean & jerk for the bodyweight less than 76.55, and the Total (kg) of ? | SELECT clean_ & _jerk FROM table_name_36 WHERE bodyweight < 76.55 AND total__kg_ = "–" | sql_create_context |
CREATE TABLE table_name_33 (
away_team VARCHAR,
home_team VARCHAR
) | in a game against st kilda, what was the away team's score? | SELECT away_team FROM table_name_33 WHERE home_team = "st kilda" | sql_create_context |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE procedures (
... | provide the number of patients whose insurance is private and lab test name is alveolar-arterial gradient? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.insurance = "Private" AND lab.label = "Alveolar-arterial Gradient" | mimicsql_data |
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... | 患者吕建茗所有检验报告单中的标本采集部位在2008年7月2日到2019年5月18日期间内都是那几个部位? | SELECT jybgb.BBCJBW FROM hz_info JOIN mzjzjlb JOIN jybgb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE hz_info.person_info_XM = '吕建茗' AND jybgb.BGRQ BETWEEN '2008-07-02' AND '2019-05-18... | css |
CREATE TABLE ref_transaction_types (
transaction_type_code text,
transaction_type_description text
)
CREATE TABLE investors (
investor_id number,
investor_details text
)
CREATE TABLE transactions (
transaction_id number,
investor_id number,
transaction_type_code text,
date_of_transacti... | Find the number of investors in total. | SELECT COUNT(*) FROM investors | spider |
CREATE TABLE appellations (
No INTEGER,
Appelation TEXT,
County TEXT,
State TEXT,
Area TEXT,
isAVA TEXT
)
CREATE TABLE grapes (
ID INTEGER,
Grape TEXT,
Color TEXT
)
CREATE TABLE wine (
No INTEGER,
Grape TEXT,
Winery TEXT,
Appelation TEXT,
State TEXT,
Name TE... | Bar graph to show how many year from different year, sort the number of year in desc order. | SELECT Year, COUNT(Year) FROM wine ORDER BY COUNT(Year) DESC | nvbench |
CREATE TABLE PostHistoryTypes (
Id number,
Name text
)
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Na... | Top 100 Users from India (based on Reputation). Note - The list can't be perfect as many users don't specify their location. | SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%india%' OR UPPER(Location) LIKE '%IN' ORDER BY Reputation DESC LIMIT 100 | sede |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
... | count the number of patients whose ethnicity is white -russian. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "WHITE - RUSSIAN" | mimicsql_data |
CREATE TABLE table_2840500_5 (
nhl_team VARCHAR,
college_junior_club_team VARCHAR
) | Which team drafted the player from the HC Lada Togliatti (Russia)? | SELECT nhl_team FROM table_2840500_5 WHERE college_junior_club_team = "HC Lada Togliatti (Russia)" | sql_create_context |
CREATE TABLE table_name_31 (
gold VARCHAR,
bronze INTEGER
) | What is the value for Gold, when the value for Bronze is less than 0? | SELECT COUNT(gold) FROM table_name_31 WHERE bronze < 0 | sql_create_context |
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE locations (
LOCATION_ID decimal(4,0),
STREET_ADDRESS varchar(40),
POSTAL_CODE varchar(12),
CITY varchar(30),
STATE_PROVINCE varchar(25... | For all employees who have the letters D or S in their first name, give me the comparison about the amount of job_id over the job_id , and group by attribute job_id by a bar chart, I want to order in desc by the Y please. | SELECT JOB_ID, COUNT(JOB_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY COUNT(JOB_ID) DESC | nvbench |
CREATE TABLE table_75187 (
"Company" text,
"Type" text,
"Principal activities" text,
"Incorporated in" text,
"Group's Equity Shareholding (10 March 2010)" text
) | What is the name of the company that has a Group's equity shareholding percentage, as of March 10th, 2010, of 100%, as well as a Principal activity of Airline? | SELECT "Company" FROM table_75187 WHERE "Group's Equity Shareholding (10 March 2010)" = '100%' AND "Principal activities" = 'airline' | wikisql |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
... | get the number of black/cape verdean ethnic background patients who have diagnoses icd9 code 56983. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND diagnoses.icd9_code = "56983" | mimicsql_data |
CREATE TABLE table_55129 (
"Name" text,
"Actual version" text,
"System" text,
"Platform" text,
"License" text
) | What name has a License of gpl, and an Actual version of 0.8.29wip4? | SELECT "Name" FROM table_55129 WHERE "License" = 'gpl' AND "Actual version" = '0.8.29wip4' | wikisql |
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,... | find the drug code and drug route of neutra-phos. | SELECT prescriptions.formulary_drug_cd, prescriptions.route FROM prescriptions WHERE prescriptions.drug = "Neutra-Phos" | mimicsql_data |
CREATE TABLE Participants_in_Events (
Event_ID INTEGER,
Participant_ID INTEGER
)
CREATE TABLE Events (
Event_ID INTEGER,
Service_ID INTEGER,
Event_Details VARCHAR(255)
)
CREATE TABLE Services (
Service_ID INTEGER,
Service_Type_Code CHAR(15)
)
CREATE TABLE Participants (
Participant_ID... | Please draw a histogram to show the total number of participants in each type code, and I want to show by the y-axis from low to high please. | SELECT Participant_Type_Code, COUNT(Participant_Type_Code) FROM Participants GROUP BY Participant_Type_Code ORDER BY COUNT(Participant_Type_Code) | nvbench |
CREATE TABLE table_29598 (
"Game" real,
"Date" text,
"Opponent" text,
"Score" text,
"First Star" text,
"Decision" text,
"Location" text,
"Attendance" real,
"Record" text,
"Points" real
) | What was the record for the October 16 game? | SELECT "Record" FROM table_29598 WHERE "Date" = 'October 16' | wikisql |
CREATE TABLE table_203_171 (
id number,
"place\n(posicion)" number,
"team\n(equipo)" text,
"played\n(pj)" number,
"won\n(pg)" number,
"draw\n(pe)" number,
"lost\n(pp)" number,
"goals scored\n(gf)" number,
"goals conceded\n(gc)" number,
"+/-\n(dif.)" number,
"points\n(pts.)" n... | which team scored the most goals in the apertura 2008 standings ? | SELECT "team\n(equipo)" FROM table_203_171 ORDER BY "goals scored\n(gf)" DESC LIMIT 1 | squall |
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... | 在不同科室编码下,列出所有医疗就诊记录的统筹基金支出与医疗费总额在医院5365915是多大平均比值? | SELECT t_kc24.t_kc21_MED_ORG_DEPT_CD, AVG(t_kc24.OVE_PAY) FROM t_kc24 WHERE t_kc24.t_kc21_MED_SER_ORG_NO = '5365915' GROUP BY t_kc24.t_kc21_MED_ORG_DEPT_CD | css |
CREATE TABLE table_74032 (
"No. in series" real,
"No. in season" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" text,
"U.S. viewers (millions)" text
) | What was the air date of the episode that has a production code of 5aky13? | SELECT "Original air date" FROM table_74032 WHERE "Production code" = '5AKY13' | wikisql |
CREATE TABLE hz_info (
KH text,
KLX number,
YLJGDM text,
RYBH text
)
CREATE TABLE jybgb (
YLJGDM text,
YLJGDM_MZJZJLB text,
YLJGDM_ZYJZJLB text,
BGDH text,
BGRQ time,
JYLX number,
JZLSH text,
JZLSH_MZJZJLB text,
JZLSH_ZYJZJLB text,
JZLX number,
KSBM text,
... | 2008年5月16日-2018年8月8日期间,苏幼安这名患者的428058这个指标的所有记录 | (SELECT * FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb 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 = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGD... | css |
CREATE TABLE has_allergy (
stuid number,
allergy text
)
CREATE TABLE student (
stuid number,
lname text,
fname text,
age number,
sex text,
major number,
advisor number,
city_code text
)
CREATE TABLE allergy_type (
allergy text,
allergytype text
) | Show the student id of the oldest student. | SELECT stuid FROM student WHERE age = (SELECT MAX(age) FROM student) | spider |
CREATE TABLE table_name_9 (
date VARCHAR,
performance VARCHAR
) | On which date is there a performance of more than 8.22.72? | SELECT date FROM table_name_9 WHERE performance = "8.22.72" | sql_create_context |
CREATE TABLE table_52268 (
"Entrant" text,
"Constructor" text,
"Chassis" text,
"Engine" text,
"Tyre" text,
"Driver" text,
"Rounds" text
) | What driver has a 166 c 500 chassis? | SELECT "Driver" FROM table_52268 WHERE "Chassis" = '166 c 500' | wikisql |
CREATE TABLE table_19742 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Record" text,
"Game Site" text,
"Attendance" real
) | How many games were played against the Chicago Bears? | SELECT COUNT("Record") FROM table_19742 WHERE "Opponent" = 'Chicago Bears' | wikisql |
CREATE TABLE table_13422 (
"Date" text,
"Tournament" text,
"Winning Score" text,
"Margin of Victory" text,
"Runner(s)-up" text
) | What's the margin of victory during the Pocono Northeast Classic? | SELECT "Margin of Victory" FROM table_13422 WHERE "Tournament" = 'pocono northeast classic' | wikisql |
CREATE TABLE table_71839 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text
) | Which of the countries showed a score of 71-72=143? | SELECT "Country" FROM table_71839 WHERE "Score" = '71-72=143' | wikisql |
CREATE TABLE table_36352 (
"Outcome" text,
"Date" text,
"Surface" text,
"Partner" text,
"Opponents" text,
"Score" text
) | Which Partner has a Date of 12 july 2009? | SELECT "Partner" FROM table_36352 WHERE "Date" = '12 july 2009' | wikisql |
CREATE TABLE table_54618 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Decision" text,
"Attendance" real,
"Record" text
) | What was the score of the game on November 9 when Atlanta was the visiting team? | SELECT "Score" FROM table_54618 WHERE "Visitor" = 'atlanta' AND "Date" = 'november 9' | wikisql |
CREATE TABLE table_61599 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text
) | What is the to par for Australia and a 73-69-71=213 score? | SELECT "To par" FROM table_61599 WHERE "Country" = 'australia' AND "Score" = '73-69-71=213' | wikisql |
CREATE TABLE table_204_914 (
id number,
"year" number,
"team" text,
"games" number,
"attempts" number,
"yards" number,
"ypc" number,
"long" number,
"tds" number
) | what is his total number of games played ? | SELECT SUM("games") FROM table_204_914 | squall |
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 labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
chart... | had patient 14467's respiratory rate ever been less than 12.0 degrees in 08/this year? | 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 = 14467)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'respiratory rate'... | mimic_iii |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.