context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsystolic number,
systemicdiastolic number,
systemicmean number,
observationtime time
)
CREATE TABLE cost (
costid num... | what were the new drugs prescribed to patient 022-6959 today compared to that yesterday? | SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '022-6959') AND DATETIME(medication.drugstarttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT medication.drugname FROM medicat... | eicu |
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAddress text
)
CREATE TABLE Posts (
Id number,
PostTypeId number,
Accepted... | Gets all down votes for user. | SELECT p.Id AS "post_link", SUM(v.PostId) AS downVotes FROM Posts AS p INNER JOIN PostTypes AS pt ON pt.Id = p.PostTypeId INNER JOIN Votes AS v ON v.PostId = p.Id INNER JOIN VoteTypes AS vt ON vt.Id = v.VoteTypeId WHERE p.OwnerUserId = '##UserId##' AND vt.Id = 3 AND p.PostTypeId = 1 GROUP BY p.Id | sede |
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... | 把医疗就诊06309706061的定点医疗机构编码提供一下 | SELECT FLX_MED_ORG_ID FROM t_kc21 WHERE MED_CLINIC_ID = '06309706061' | css |
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... | 列出医院编码3290779根据不相同的科室名字和出院诊断疾病名字全部医疗就诊记录中病人保留平均年龄大于29岁的记录的平均年龄都是多大啊? | SELECT qtb.MED_ORG_DEPT_NM, qtb.OUT_DIAG_DIS_NM, AVG(qtb.PERSON_AGE) FROM qtb WHERE qtb.MED_SER_ORG_NO = '3290779' GROUP BY qtb.MED_ORG_DEPT_NM, qtb.OUT_DIAG_DIS_NM HAVING AVG(qtb.PERSON_AGE) > 29 UNION SELECT gyb.MED_ORG_DEPT_NM, gyb.OUT_DIAG_DIS_NM, AVG(gyb.PERSON_AGE) FROM gyb WHERE gyb.MED_SER_ORG_NO = '3290779' GR... | css |
CREATE TABLE table_30214 (
"Draw" real,
"Artist" text,
"Song (English translation)" text,
"Lyrics (l) / Music (m)" text,
"Juries" real,
"Viewers" real,
"Total" real,
"Place" real
) | How many juries are there when the draw is 3? | SELECT MAX("Juries") FROM table_30214 WHERE "Draw" = '3' | wikisql |
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name text
)
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
sh... | how much does patient 15794 change in weight last measured on the current hospital visit compared to the second to last value measured on the current hospital visit? | SELECT (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 = 15794 AND admissions.dischtime IS NULL)) AND chartevents.itemid IN (SELECT d_items.itemid FROM... | mimic_iii |
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 language is engl and lab test name is creatine kinase, mb isoenzyme? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.language = "ENGL" AND lab.label = "Creatine Kinase, MB Isoenzyme" | mimicsql_data |
CREATE TABLE table_15143 (
"Name" text,
"Design" text,
"Manufacturer" text,
"Acquired" real,
"Disposed" text
) | What design was acquired in 1875? | SELECT "Design" FROM table_15143 WHERE "Acquired" = '1875' | wikisql |
CREATE TABLE table_53687 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | Who was the home team that scored 19.18 (132)? | SELECT "Home team" FROM table_53687 WHERE "Home team score" = '19.18 (132)' | wikisql |
CREATE TABLE table_14951 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Record" text
) | Who is the home team of the game on December 21? | SELECT "Home" FROM table_14951 WHERE "Date" = 'december 21' | wikisql |
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 ... | how many patients on elective admission had their epithelial cells tested by lab? | 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 = "Epithelial Cells" | mimicsql_data |
CREATE TABLE table_22064 (
"Story No." text,
"Episode" real,
"Title" text,
"Directed by" text,
"Written by" text,
"UK viewers (million)" text,
"AI (%)" real,
"Original air date" text,
"Production code" text
) | Name the story number for paul cornell | SELECT "Story No." FROM table_22064 WHERE "Written by" = 'Paul Cornell' | wikisql |
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name text
)
CREATE TABLE transfers (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
eventtype text,
careunit text,
wardi... | what were the five most commonly given diagnoses for patients who had received opn rt hemicolectomy nec before within 2 months the previous year? | 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, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissi... | mimic_iii |
CREATE TABLE table_1777 (
"Parish ( Prestegjeld )" text,
"Sub-Parish (Sokn)" text,
"Church Name" text,
"Year Built" real,
"Location of the Church" text
) | Name the location of the church for berle kyrkje | SELECT "Location of the Church" FROM table_1777 WHERE "Church Name" = 'Berle kyrkje' | wikisql |
CREATE TABLE table_30194 (
"No. in series" real,
"No. in season" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" real
) | What is the title of episode 155 in the series? | SELECT "Title" FROM table_30194 WHERE "No. in series" = '155' | wikisql |
CREATE TABLE table_name_67 (
week_1 VARCHAR,
week_3 VARCHAR
) | Name the week 3 of 36 | SELECT week_1 FROM table_name_67 WHERE week_3 = "36" | sql_create_context |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
sy... | what was the name of the procedure that's been performed to patient 027-188709 two or more times in this hospital encounter? | SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, COUNT(treatment.treatmenttime) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid ... | eicu |
CREATE TABLE table_37939 (
"Round" real,
"Pick #" real,
"Overall" real,
"Name" text,
"Position" text,
"College" text
) | Which highest pick number's name was Adam Podlesh, when the overall was less than 101? | SELECT MAX("Pick #") FROM table_37939 WHERE "Name" = 'adam podlesh' AND "Overall" < '101' | 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... | 俞英卓病患在11年12月30日到2015年4月15日之间买了几次西药? | SELECT COUNT(*) FROM gwyjzb JOIN t_kc22 ON gwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gwyjzb.PERSON_NM = '俞英卓' AND t_kc22.STA_DATE BETWEEN '2011-12-30' AND '2015-04-15' AND t_kc22.MED_INV_ITEM_TYPE = '西药费' UNION SELECT COUNT(*) FROM fgwyjzb JOIN t_kc22 ON fgwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE fgwyjz... | css |
CREATE TABLE table_22828 (
"DMA" real,
"Market" text,
"Station" text,
"Frequency" text,
"Branding" text,
"Format" text
) | Which station has the frequency of 107.3? | SELECT "Station" FROM table_22828 WHERE "Frequency" = '107.3' | wikisql |
CREATE TABLE table_4525 (
"Name" text,
"Pole Position" text,
"Fastest Lap" text,
"Winning driver" text,
"Winning team" text,
"Report" text
) | Who did Teo Fabi drive for when he won and had pole position? | SELECT "Winning team" FROM table_4525 WHERE "Winning driver" = 'teo fabi' AND "Pole Position" = 'teo fabi' | wikisql |
CREATE TABLE table_name_56 (
away_team VARCHAR
) | What was the score when the away team was Collingwood? | SELECT away_team AS score FROM table_name_56 WHERE away_team = "collingwood" | sql_create_context |
CREATE TABLE table_name_71 (
diameter INTEGER,
longitude VARCHAR
) | What's the lowest diameter when the longitude is 71.1w? | SELECT MIN(diameter) FROM table_name_71 WHERE longitude = "71.1w" | sql_create_context |
CREATE TABLE table_45167 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
) | Which team did Tyson Chandler (7) have high rebounds for? | SELECT "Team" FROM table_45167 WHERE "High rebounds" = 'tyson chandler (7)' | wikisql |
CREATE TABLE diagnoses_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,
... | what are the three most commonly performed procedures in this year? | 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, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM procedures_icd WHERE DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of ye... | mimic_iii |
CREATE TABLE hz_info (
KH text,
KLX number,
RYBH text,
YLJGDM text
)
CREATE TABLE fzzmzjzjlb (
HXPLC number,
HZXM text,
JLSJ time,
JZJSSJ time,
JZKSBM text,
JZKSMC text,
JZKSRQ time,
JZLSH number,
JZZDBM text,
JZZDSM text,
JZZTDM number,
JZZTMC text,
... | 列出在医院0621051中患者04455332门诊诊断名称包含形式的门诊有什么就诊记录? | SELECT * FROM hz_info JOIN zzmzjzjlb ON hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX WHERE hz_info.RYBH = '04455332' AND hz_info.YLJGDM = '0621051' AND zzmzjzjlb.JZZDSM LIKE '%形式%' UNION SELECT * FROM hz_info JOIN fzzmzjzjlb ON hz_info.YLJGDM = fzzmzjzjlb.YLJGDM AND hz... | css |
CREATE TABLE table_71525 (
"Year" text,
"Start" text,
"Qual" text,
"Rank" text,
"Finish" text,
"Laps" real
) | Which year did Tony Bettenhausen complete more than 200 laps? | SELECT "Year" FROM table_71525 WHERE "Laps" > '200' | wikisql |
CREATE TABLE manufacturer (
manufacturer_id number,
open_year number,
name text,
num_of_factories number,
num_of_shops number
)
CREATE TABLE furniture_manufacte (
manufacturer_id number,
furniture_id number,
price_in_dollar number
)
CREATE TABLE furniture (
furniture_id number,
... | Find the average number of factories for the manufacturers that have more than 20 shops. | SELECT AVG(num_of_factories) FROM manufacturer WHERE num_of_shops > 20 | spider |
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
)
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
) | Draw a bar chart for what are the average prices of products, grouped by manufacturer name?, and I want to show by the Y from high to low. | 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) DESC | nvbench |
CREATE TABLE Actual_Orders (
actual_order_id INTEGER,
order_status_code VARCHAR(10),
regular_order_id INTEGER,
actual_order_date DATETIME
)
CREATE TABLE Customers (
customer_id INTEGER,
payment_method VARCHAR(10),
customer_name VARCHAR(80),
customer_phone VARCHAR(80),
customer_email... | List the state names and the number of customers living in each state with a bar chart, could you rank by the the total number in asc please? | SELECT state_province_county, COUNT(*) FROM Customer_Addresses AS t1 JOIN Addresses AS t2 ON t1.address_id = t2.address_id GROUP BY t2.state_province_county ORDER BY COUNT(*) | nvbench |
CREATE TABLE table_24689168_5 (
episode VARCHAR,
viewers__millions_ VARCHAR
) | what episode number had 11.73 million viewers? | SELECT episode FROM table_24689168_5 WHERE viewers__millions_ = "11.73" | sql_create_context |
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime... | a month before has patient 016-18150 been getting any output amt-blake drain output? | SELECT COUNT(*) > 0 FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-18150')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutpu... | eicu |
CREATE TABLE table_name_86 (
starts INTEGER,
wins INTEGER
) | On average, how many Starts have Wins that are smaller than 0? | SELECT AVG(starts) FROM table_name_86 WHERE wins < 0 | sql_create_context |
CREATE TABLE gas_station (
station_id VARCHAR,
LOCATION VARCHAR,
manager_name VARCHAR,
open_year VARCHAR
) | Show gas station id, location, and manager_name for all gas stations ordered by open year. | SELECT station_id, LOCATION, manager_name FROM gas_station ORDER BY open_year | sql_create_context |
CREATE TABLE table_name_34 (
against INTEGER,
difference VARCHAR,
lost VARCHAR
) | Which average's against score has 2 as a difference and a lost of 5? | SELECT AVG(against) FROM table_name_34 WHERE difference = "2" AND lost = 5 | sql_create_context |
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate n... | when was patient 002-59265 first prescribed with pulmicort respule and zosyn at the same time? | SELECT t1.drugstarttime FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'pulmicort respule' AND patient.uniquepid = '002-59265') AS t1 JOIN (SELECT patient.uniquepid, medication.drugstarttime FR... | eicu |
CREATE TABLE county (
Population INTEGER
) | Show the average population of all counties. | SELECT AVG(Population) FROM county | sql_create_context |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE demographic (... | find out the number of patients who have been prescribed neo*iv*ampicillin sodium. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "NEO*IV*AMPicillin Sodium" | mimicsql_data |
CREATE TABLE table_7916 (
"Name" text,
"League" real,
"FA Cup" real,
"League Cup" real,
"Total" real
) | what is the total when the league is less than 1? | SELECT "Total" FROM table_7916 WHERE "League" < '1' | wikisql |
CREATE TABLE table_39624 (
"Name" text,
"Livery" text,
"Arrival" real,
"Type" text,
"Configuration" text,
"Builder" text,
"Built" real,
"Status" text,
"Location" text
) | for type diesel-mechanical and configuration b-b, what is the status? | SELECT "Status" FROM table_39624 WHERE "Configuration" = 'b-b' AND "Type" = 'diesel-mechanical' | wikisql |
CREATE TABLE table_name_3 (
speed VARCHAR,
construction_begun VARCHAR,
expected_start_of_revenue_services VARCHAR
) | What is the Speed when Construction begun in 2010, and an Expected start of revenue services of 2015? | SELECT speed FROM table_name_3 WHERE construction_begun = "2010" AND expected_start_of_revenue_services = 2015 | 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 (
... | what is minimum age of patients whose marital status is divorced and primary disease is posterior communicating aneurysm/sda? | SELECT MIN(demographic.age) FROM demographic WHERE demographic.marital_status = "DIVORCED" AND demographic.diagnosis = "POSTERIOR COMMUNICATING ANEURYSM/SDA" | mimicsql_data |
CREATE TABLE Financial_Transactions (
transaction_id INTEGER,
previous_transaction_id INTEGER,
account_id INTEGER,
card_id INTEGER,
transaction_type VARCHAR(15),
transaction_date DATETIME,
transaction_amount DOUBLE,
transaction_comment VARCHAR(255),
other_transaction_details VARCHAR(... | Give me a bar chart showing the number of customers who has an account for each customer last name, and sort from high to low by the y axis please. | SELECT customer_last_name, COUNT(customer_last_name) FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id GROUP BY customer_last_name ORDER BY COUNT(customer_last_name) DESC | nvbench |
CREATE TABLE table_name_60 (
away_team VARCHAR,
venue VARCHAR
) | What away team plays at Victoria Park? | SELECT away_team FROM table_name_60 WHERE venue = "victoria park" | sql_create_context |
CREATE TABLE table_18389 (
"District" text,
"Incumbent" text,
"Party" text,
"First elected" real,
"Result" text,
"Candidates" text
) | What district did Joe Waggonner belong to? | SELECT "District" FROM table_18389 WHERE "Incumbent" = 'Joe Waggonner' | wikisql |
CREATE TABLE table_name_16 (
airport VARCHAR,
icao VARCHAR
) | What airport has an ICAO of Birk? | SELECT airport FROM table_name_16 WHERE icao = "birk" | sql_create_context |
CREATE TABLE table_name_23 (
class VARCHAR,
race VARCHAR
) | What class is the dodge dealers grand prix? | SELECT class FROM table_name_23 WHERE race = "the dodge dealers grand prix" | sql_create_context |
CREATE TABLE employees (
EMPLOYEE_ID decimal(6,0),
FIRST_NAME varchar(20),
LAST_NAME varchar(25),
EMAIL varchar(25),
PHONE_NUMBER varchar(20),
HIRE_DATE date,
JOB_ID varchar(10),
SALARY decimal(8,2),
COMMISSION_PCT decimal(2,2),
MANAGER_ID decimal(6,0),
DEPARTMENT_ID decimal(... | For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the distribution of email and salary in a bar chart. | SELECT EMAIL, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) | nvbench |
CREATE TABLE t_kc22 (
AMOUNT number,
CHA_ITEM_LEV number,
DATA_ID text,
DIRE_TYPE number,
DOSE_FORM text,
DOSE_UNIT text,
EACH_DOSAGE text,
EXP_OCC_DATE time,
FLX_MED_ORG_ID text,
FXBZ number,
HOSP_DOC_CD text,
HOSP_DOC_NM text,
MED_DIRE_CD text,
MED_DIRE_NM text,... | 在编号为1303547的医院,查出非科室乳腺负责的在2003-02-21到2005-09-08内所有医疗就诊记录 | SELECT * FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '1303547' AND t_kc21.IN_HOSP_DATE BETWEEN '2003-02-21' AND '2005-09-08' EXCEPT SELECT * FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '1303547' AND t_kc21.IN_HOSP_DATE BETWEEN '2003-02-21' AND '2005-09-08' AND t_kc21.MED_ORG_DEPT_NM = '乳腺外科' | css |
CREATE TABLE table_203_344 (
id number,
"#" number,
"date" text,
"opponent" text,
"score" text,
"win" text,
"loss" text,
"save" text,
"attendance" number,
"record" text,
"other info" text
) | what is the date of the last game on this chart ? | SELECT "date" FROM table_203_344 ORDER BY id DESC LIMIT 1 | squall |
CREATE TABLE table_67552 (
"Season" real,
"Series" text,
"Races" text,
"Wins" text,
"Position" text
) | What is the smallest season with 6 races, 2 wins, and a Series of all-japan gt championship> | SELECT MIN("Season") FROM table_67552 WHERE "Races" = '6' AND "Series" = 'all-japan gt championship' AND "Wins" = '2' | wikisql |
CREATE TABLE table_22779004_1 (
regular_season_winner VARCHAR,
tournament_winner VARCHAR
) | Who won the regular season when Maryland won the tournament? | SELECT regular_season_winner FROM table_22779004_1 WHERE tournament_winner = "Maryland" | sql_create_context |
CREATE TABLE table_name_52 (
player VARCHAR,
pick VARCHAR
) | What player was drafted 252? | SELECT player FROM table_name_52 WHERE pick = 252 | sql_create_context |
CREATE TABLE table_28298589_2 (
site VARCHAR,
time VARCHAR,
visiting_team VARCHAR
) | How many site entries are there at 3:30pm and the visiting team is coastal carolina? | SELECT COUNT(site) FROM table_28298589_2 WHERE time = "3:30pm" AND visiting_team = "Coastal Carolina" | sql_create_context |
CREATE TABLE table_name_20 (
total VARCHAR,
year_s__won VARCHAR
) | What was the total for the golfer who had a year won of 1987? | SELECT total FROM table_name_20 WHERE year_s__won = "1987" | sql_create_context |
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
amount number
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid n... | what were the top five medicines that were frequently prescribed? | SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 <= 5 | mimic_iii |
CREATE TABLE captain (
Captain_ID int,
Name text,
Ship_ID int,
age text,
Class text,
Rank text
)
CREATE TABLE Ship (
Ship_ID int,
Name text,
Type text,
Built_Year real,
Class text,
Flag text
) | Give me a bar chart showing the total number of ships' classes that do not have a captain, show from low to high by the y-axis please. | SELECT Class, COUNT(Class) FROM Ship WHERE NOT Ship_ID IN (SELECT Ship_ID FROM captain) GROUP BY Class ORDER BY COUNT(Class) | nvbench |
CREATE TABLE table_60608 (
"Official Name" text,
"Status" text,
"Area km 2" real,
"Population" real,
"Census Ranking" text
) | Which Census Ranking has a Population smaller than 879, and an Area km 2 larger than 537.62? | SELECT "Census Ranking" FROM table_60608 WHERE "Population" < '879' AND "Area km 2" > '537.62' | wikisql |
CREATE TABLE table_59995 (
"Election" text,
"First member" text,
"First party" text,
"Second member" text,
"Second party" text
) | Who is the second member with first member Sir Rowland Hill, BT, and a conservative second party? | SELECT "Second member" FROM table_59995 WHERE "First member" = 'sir rowland hill, bt' AND "Second party" = 'conservative' | wikisql |
CREATE TABLE table_name_18 (
award_ceremony VARCHAR,
nominee VARCHAR
) | For which Award Ceremony was Emilio Pichardo as Bobby Strong nominated? | SELECT award_ceremony FROM table_name_18 WHERE nominee = "emilio pichardo as bobby strong" | sql_create_context |
CREATE TABLE table_name_12 (
week INTEGER,
opponent VARCHAR,
attendance VARCHAR
) | What is the average week for the game against baltimore colts with less than 41,062 in attendance? | SELECT AVG(week) FROM table_name_12 WHERE opponent = "baltimore colts" AND attendance < 41 OFFSET 062 | sql_create_context |
CREATE TABLE table_name_69 (
high_assists VARCHAR,
date VARCHAR
) | What is the High assists for march 25? | SELECT high_assists FROM table_name_69 WHERE date = "march 25" | 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 countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
CREATE TABLE employees (
EMPLOYEE_ID decimal(6,0),... | For those employees who do not work in departments with managers that have ids between 100 and 200, visualize a bar chart about the distribution of hire_date and the average of employee_id bin hire_date by weekday, and show y-axis from high to low order. | SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(EMPLOYEE_ID) DESC | nvbench |
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
... | calculate the number of patients who were dead after being diagnosed with acute respiratory failure within the same hospital visit until 2102. | SELECT COUNT(DISTINCT t2.uniquepid) FROM (SELECT t1.uniquepid, t1.diagnosistime, t1.patienthealthsystemstayid FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = ... | eicu |
CREATE TABLE table_name_65 (
country VARCHAR,
player VARCHAR
) | What is the country of Craig Stadler? | SELECT country FROM table_name_65 WHERE player = "craig stadler" | sql_create_context |
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospita... | what is the maximum total cost of the hospital involving a laboratory glucose test in 2105? | SELECT MAX(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 = 'glucose')) AND STRFTIME('%y', cost.chargetime) = '2105' GROUP BY cos... | eicu |
CREATE TABLE table_77051 (
"Team" text,
"Manager" text,
"Home city" text,
"Stadium" text,
"Capacity" real
) | What team has a home city of Velika? | SELECT "Team" FROM table_77051 WHERE "Home city" = 'velika' | wikisql |
CREATE TABLE customers (
customer_id number,
customer_name text
)
CREATE TABLE services (
service_id number,
service_name text
)
CREATE TABLE first_notification_of_loss (
fnol_id number,
customer_id number,
policy_id number,
service_id number
)
CREATE TABLE settlements (
settlemen... | Which customers have used the service named 'Close a policy' or 'Upgrade a policy'? Give me the customer names. | SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id WHERE t3.service_name = "Close a policy" OR t3.service_name = "Upgrade a policy" | spider |
CREATE TABLE table_71385 (
"Round" real,
"Pick #" real,
"Overall" real,
"Name" text,
"Position" text,
"College" text
) | Which was the position for overall less than 254, round less than 5 and pick number less than 13? | SELECT "Position" FROM table_71385 WHERE "Overall" < '254' AND "Round" < '5' AND "Pick #" < '13' | wikisql |
CREATE TABLE table_name_22 (
release_date VARCHAR,
dvd_title VARCHAR
) | What is the release date for Ben 10: Alien Force Volume 9 on DVD? | SELECT release_date FROM table_name_22 WHERE dvd_title = "ben 10: alien force volume 9" | sql_create_context |
CREATE TABLE table_204_636 (
id number,
"season" text,
"tier" number,
"division" text,
"pos." text,
"notes" text
) | what tier was this team placed into next after their 2011-2012 season ? | SELECT "tier" FROM table_204_636 WHERE "season" > '2011-12' ORDER BY "season" LIMIT 1 | squall |
CREATE TABLE table_204_164 (
id number,
"branding" text,
"callsign" text,
"frequency" text,
"power (kw)" text,
"location" text
) | how many stations have at least 5 kw or more listed in the power column ? | SELECT COUNT("branding") FROM table_204_164 WHERE "power (kw)" >= 5 | squall |
CREATE TABLE table_169766_13 (
new_returning_same_network VARCHAR,
show VARCHAR
) | What is the new/returning/same network name for This Week in Baseball? | SELECT new_returning_same_network FROM table_169766_13 WHERE show = "This Week in Baseball" | sql_create_context |
CREATE TABLE table_name_31 (
name VARCHAR,
province VARCHAR,
appointed VARCHAR
) | Who was appointed on October 21, 2011 from Quebec? | SELECT name FROM table_name_31 WHERE province = "quebec" AND appointed = "october 21, 2011" | sql_create_context |
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob te... | let me know the long title and icd9 code of diagnoses for patient with patient id 7273. | SELECT diagnoses.icd9_code, diagnoses.long_title FROM diagnoses WHERE diagnoses.subject_id = "7273" | mimicsql_data |
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... | 患者63660143在二00七年七月二十一日到二0一0年十二月二十四日期间,总共医治过几种病 | SELECT COUNT(gwyjzb.IN_DIAG_DIS_CD) FROM gwyjzb WHERE gwyjzb.PERSON_ID = '63660143' AND gwyjzb.IN_HOSP_DATE BETWEEN '2007-07-21' AND '2010-12-24' UNION SELECT COUNT(fgwyjzb.IN_DIAG_DIS_CD) FROM fgwyjzb WHERE fgwyjzb.PERSON_ID = '63660143' AND fgwyjzb.IN_HOSP_DATE BETWEEN '2007-07-21' AND '2010-12-24' | css |
CREATE TABLE table_45464 (
"Year" real,
"Seed" real,
"Round" text,
"Opponent" text,
"Result/Score" text
) | What is Round when Year is 1987? | SELECT "Round" FROM table_45464 WHERE "Year" = '1987' | wikisql |
CREATE TABLE table_71336 (
"Year" real,
"Competition" text,
"Venue" text,
"Position" text,
"Notes" text
) | What is the venue when the year is after 2001 for the summer olympics? | SELECT "Venue" FROM table_71336 WHERE "Year" > '2001' AND "Competition" = 'summer olympics' | wikisql |
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
value number
)
CREATE TABLE d_... | what was the last arterial bp [diastolic] value for patient 15107 on 11/21/last year? | 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 = 15107)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial ... | mimic_iii |
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PostHistory (
Id number,
PostHistoryTypeId number,
PostId number,
RevisionGUID other,
CreationDate time,
UserId number,
UserDisplayName text,
Comment text,
Text text,
ContentLicense... | Recent Unanswered Posts About C# & LINQ. | SELECT Id AS "post_link", CreationDate, Score, ViewCount AS "v", AnswerCount AS "a", CommentCount AS "c", LastActivityDate, Tags FROM Posts WHERE ClosedDate IS NULL AND AnswerCount = 0 AND LastActivityDate > (CURRENT_TIMESTAMP() - 10) ORDER BY LastActivityDate DESC LIMIT 100 | sede |
CREATE TABLE requirement (
requirement_id int,
requirement varchar,
college varchar
)
CREATE TABLE semester (
semester_id int,
semester varchar,
year int
)
CREATE TABLE program_requirement (
program_id int,
category varchar,
min_credit int,
additional_req varchar
)
CREATE TABL... | For the Fall term , are any PreMajor or MDE classes offered ? | SELECT DISTINCT course.department, course.name, course.number, program_course.category FROM course, course_offering, program_course, semester WHERE course.course_id = course_offering.course_id AND program_course.category IN ('PreMajor', 'MDE') AND program_course.course_id = course.course_id AND semester.semester = 'Fal... | advising |
CREATE TABLE table_name_74 (
venue VARCHAR,
partnerships VARCHAR
) | What venue did the partnership of herschelle gibbs / justin kemp happen? | SELECT venue FROM table_name_74 WHERE partnerships = "herschelle gibbs / justin kemp" | sql_create_context |
CREATE TABLE table_1140117_5 (
report VARCHAR,
race_name VARCHAR
) | What is the report for the race name V Ulster Trophy? | SELECT report FROM table_1140117_5 WHERE race_name = "V Ulster Trophy" | 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... | 想知道患者蒋阳飙在二0一一年十月十四日到二0二0年十一月十九日期间被开出利可君片(薄膜衣)的总次数是多少 | SELECT COUNT(*) FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_NM = '蒋阳飙' AND t_kc22.STA_DATE BETWEEN '2011-10-14' AND '2020-11-19' AND t_kc22.SOC_SRT_DIRE_NM = '利可君片(薄膜衣)' | 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
)
... | how many patients have a private insurance policy and whose icd9 code is 4610? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Private" AND procedures.icd9_code = "4610" | mimicsql_data |
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wardid number,
admissionheight number,
admissionweight number,
dischargeweight number,
hospitaladmittime time,
... | how many patients received the endotracheal tube within 2 months after receiving the laxatives - psyllium (metamucil, polycarbophil) this year? | SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'laxatives - psyllium (metamucil, polycarbophil)' AND DATETIME(treatment.treatmenttime, 'start of year') = DA... | eicu |
CREATE TABLE table_29873 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
) | Who in the high rebounds is in the honda center 15,625 location attendance? | SELECT "High rebounds" FROM table_29873 WHERE "Location Attendance" = 'Honda Center 15,625' | wikisql |
CREATE TABLE table_33946 (
"Date" text,
"Tournament" text,
"Surface" text,
"Partner" text,
"Opponents in the final" text,
"Score" text
) | Who is the partner facing the opponents florian Mayer & alexander waske in the final? | SELECT "Partner" FROM table_33946 WHERE "Opponents in the final" = 'florian mayer & alexander waske' | wikisql |
CREATE TABLE table_25691838_2 (
guest VARCHAR,
production_code VARCHAR
) | Who were the guests in the episode with production code 6021? | SELECT guest FROM table_25691838_2 WHERE production_code = 6021 | sql_create_context |
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob te... | let me know the birth date and preferred language of patient james sloan. | SELECT demographic.dob, demographic.language FROM demographic WHERE demographic.name = "James Sloan" | mimicsql_data |
CREATE TABLE table_30345 (
"Character" text,
"Game" text,
"Platform" text,
"Status" text,
"Mystic Arte" text,
"Character Voice" text
) | How many mystic arte have hisui (jadeite) hearts 1 as the character? | SELECT COUNT("Mystic Arte") FROM table_30345 WHERE "Character" = 'Hisui (Jadeite) Hearts 1' | wikisql |
CREATE TABLE table_name_92 (
team VARCHAR,
qual_2 VARCHAR
) | What team had a qual 2 time of 58.385? | SELECT team FROM table_name_92 WHERE qual_2 = "58.385" | sql_create_context |
CREATE TABLE table_5514 (
"Game" real,
"January" real,
"Opponent" text,
"Score" text,
"Record" text
) | What is the sum of games for a record of 33-13-3? | SELECT SUM("Game") FROM table_5514 WHERE "Record" = '33-13-3' | wikisql |
CREATE TABLE table_62721 (
"Elector" text,
"Place of birth" text,
"Cardinalatial title" text,
"Elevated" text,
"Elevator" text
) | Who is the elevator with the cardinalatial title of Deacon of SS. Sergio e Bacco? | SELECT "Elevator" FROM table_62721 WHERE "Cardinalatial title" = 'deacon of ss. sergio e bacco' | wikisql |
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugst... | how many hours have passed since the first time patient 006-133605 has taken a bicarbonate lab test in the current hospital encounter? | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', lab.labresulttime)) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-133605' AND patient.hos... | eicu |
CREATE TABLE Apartment_Buildings (
building_id INTEGER,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80)
)
CREATE TABLE Guests (
guest_id INTEGER,
... | Show the number of apartment bookings in each year and bin booking end date by year with a bar chart. | SELECT booking_end_date, COUNT(booking_end_date) FROM Apartment_Bookings | nvbench |
CREATE TABLE table_72126 (
"Nation" text,
"Population (thousands)" real,
"Internet subscriptions (2000) (thousands of users)" real,
"Internet subscriptions (2008) (thousands of users)" real,
"% growth (2000\u20132008)" real,
"% Internet users" real
) | What is the maximum percentage grown 2000-2008 in burundi | SELECT MAX("% growth (2000\u20132008)") FROM table_72126 WHERE "Nation" = 'Burundi' | wikisql |
CREATE TABLE table_2668336_17 (
incumbent VARCHAR,
candidates VARCHAR
) | The candidates Charles Fisher (DR) 65.1% W. Jones (F) 34.9% is for what incumbent? | SELECT incumbent FROM table_2668336_17 WHERE candidates = "Charles Fisher (DR) 65.1% W. Jones (F) 34.9%" | sql_create_context |
CREATE TABLE table_43631 (
"Res." text,
"Record" text,
"Opponent" text,
"Method" text,
"Event" text,
"Round" real,
"Time" text,
"Location" text
) | What is Location, when Round is '1', and when Opponent is 'Joe Slick'? | SELECT "Location" FROM table_43631 WHERE "Round" = '1' AND "Opponent" = 'joe slick' | wikisql |
CREATE TABLE table_4214 (
"Skip (Club)" text,
"W" real,
"L" real,
"PF" real,
"PA" real,
"Ends Won" real,
"Ends Lost" real,
"Blank Ends" real,
"Stolen Ends" real
) | When 6 is the w what is the pa? | SELECT "PA" FROM table_4214 WHERE "W" = '6' | wikisql |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.