context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE table_name_88 (
team VARCHAR,
class VARCHAR,
rank VARCHAR
) | Which team has a class of 500cc and rank of 16th? | SELECT team FROM table_name_88 WHERE class = "500cc" AND rank = "16th" | sql_create_context |
CREATE TABLE table_18505065_1 (
played VARCHAR,
against VARCHAR
) | How many games had a deficit of 175? | SELECT COUNT(played) FROM table_18505065_1 WHERE against = 175 | sql_create_context |
CREATE TABLE table_18539834_2 (
average_ratings VARCHAR,
tv_station VARCHAR
) | What is the average rating for tv asahi? | SELECT average_ratings FROM table_18539834_2 WHERE tv_station = "TV Asahi" | sql_create_context |
CREATE TABLE table_29920800_1 (
original_air_date VARCHAR,
written_by VARCHAR
) | What is the original air date of the episode written by Liz Feldman? | SELECT original_air_date FROM table_29920800_1 WHERE written_by = "Liz Feldman" | sql_create_context |
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE Comments (
Id number,
PostId number,
Score number,
Text text,
CreationDate time,
UserDisplayName text,
UserId number,
ContentLicense text
)
CREATE TABLE PostLinks (
Id number,
Crea... | Comments per week (questions with > 2 answers). | WITH test_posts AS (SELECT q.Id AS Id, q.CreationDate AS CreationDate FROM Posts AS q JOIN Posts AS a ON a.ParentId = q.Id WHERE q.AnswerCount > 2 UNION SELECT Id, CreationDate FROM Posts WHERE AnswerCount > 2) SELECT DATEADD(week, DATEDIFF(week, @epoch, CreationDate), @epoch) AS Week, COUNT(DISTINCT c.Id) AS Comments,... | sede |
CREATE TABLE table_40413 (
"8:00" text,
"8:30" text,
"9:00" text,
"9:30" text,
"10:00" text
) | What is 9:00, when 8:30 is 'My Thursday Night Movie'? | SELECT "9:00" FROM table_40413 WHERE "8:30" = 'my thursday night movie' | wikisql |
CREATE TABLE member (
member_id number,
member_name text,
party_id text,
in_office text
)
CREATE TABLE region (
region_id number,
region_name text,
date text,
label text,
format text,
catalogue text
)
CREATE TABLE party_events (
event_id number,
event_name text,
par... | How many members are in each party? | SELECT T2.party_name, COUNT(*) FROM member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id | spider |
CREATE TABLE table_203_730 (
id number,
"week" number,
"date" text,
"opponent" text,
"result" text,
"attendance" number,
"bye" text
) | which week did they not have a match ? | SELECT "week" FROM table_203_730 WHERE "date" IS NULL | squall |
CREATE TABLE table_52367 (
"Party" text,
"Leader" text,
"Votes" real,
"Percentage" text,
"Seats" real
) | What is the number of votes for the party which got more than 28 seats? | SELECT COUNT("Votes") FROM table_52367 WHERE "Seats" > '28' | wikisql |
CREATE TABLE table_74468 (
"Townland" text,
"Area( acres )" real,
"Barony" text,
"Civil parish" text,
"Poor law union" text
) | What is the poor law union of the Kilmaloda townland? | SELECT "Poor law union" FROM table_74468 WHERE "Townland" = 'Kilmaloda' | wikisql |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
... | count the number of patients whose age is less than 67 and drug code is ns451000? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "67" AND prescriptions.formulary_drug_cd = "NS451000" | mimicsql_data |
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
)
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
) | For those records from the products and each product's manufacturer, a bar chart shows the distribution of name and the average of price , and group by attribute name. | SELECT T1.Name, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name | nvbench |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wa... | during the current hospital encounter patient 035-2205 had been prescribed ondansetron? | 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 = '035-2205' AND patient.hospitaldischargetime IS NULL)) AND medication.drugn... | eicu |
CREATE TABLE Participants_in_Events (
Event_ID INTEGER,
Participant_ID INTEGER
)
CREATE TABLE Services (
Service_ID INTEGER,
Service_Type_Code CHAR(15)
)
CREATE TABLE Participants (
Participant_ID INTEGER,
Participant_Type_Code CHAR(15),
Participant_Details VARCHAR(255)
)
CREATE TABLE Eve... | Bar chart x axis participant details y axis participant_id | SELECT Participant_Details, Participant_ID FROM Participants | nvbench |
CREATE TABLE table_56413 (
"Player" text,
"Position" text,
"Date of Birth (Age)" text,
"Caps" real,
"Club/province" text
) | What is the date of birth of the player that has 11 caps and plays the prop position? | SELECT "Date of Birth (Age)" FROM table_56413 WHERE "Caps" = '11' AND "Position" = 'prop' | wikisql |
CREATE TABLE mountain (
Mountain_ID int,
Name text,
Height real,
Prominence real,
Range text,
Country text
)
CREATE TABLE climber (
Climber_ID int,
Name text,
Country text,
Time text,
Points real,
Mountain_ID int
) | What are the countries of mountains with height bigger than 5000, and count them by a bar chart | SELECT Country, COUNT(Country) FROM mountain WHERE Height > 5000 GROUP BY Country | nvbench |
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE icustays (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
first_careunit text,
last_careunit text,
first_wardid number,
... | what are patient 8204's genders? | SELECT patients.gender FROM patients WHERE patients.subject_id = 8204 | mimic_iii |
CREATE TABLE table_15823956_1 (
series VARCHAR
) | When was series premiere on the pilot episode | SELECT series AS premiere FROM table_15823956_1 WHERE series = "Pilot" | sql_create_context |
CREATE TABLE table_21330550_2 (
location VARCHAR,
time VARCHAR
) | Which location has a time of 9:30pm? | SELECT location FROM table_21330550_2 WHERE time = "9:30PM" | sql_create_context |
CREATE TABLE table_name_79 (
nationality VARCHAR,
position VARCHAR,
pick__number VARCHAR
) | What Nationality has a Position of right wing, with a #20 pick? | SELECT nationality FROM table_name_79 WHERE position = "right wing" AND pick__number = "20" | sql_create_context |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wa... | what were the five most commonly given laboratory tests for patients who were previously diagnosed with signs and symptoms of sepsis (sirs) - due to infectious process with organ dysfunction within the same hospital visit, since 2 years ago? | SELECT t3.labname FROM (SELECT t2.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'signs and symptom... | eicu |
CREATE TABLE table_22883210_11 (
team VARCHAR,
series VARCHAR
) | When 1-1 is the series who is the team? | SELECT team FROM table_22883210_11 WHERE series = "1-1" | sql_create_context |
CREATE TABLE table_name_30 (
points INTEGER,
played INTEGER
) | What is the highest Points, when Played is greater than 5? | SELECT MAX(points) FROM table_name_30 WHERE played > 5 | sql_create_context |
CREATE TABLE table_20042805_2 (
hadeda_ibis VARCHAR,
ostrich VARCHAR
) | What is the Hadeda Ibis when the Ostrich is Dark Chanting Goshawk? | SELECT hadeda_ibis FROM table_20042805_2 WHERE ostrich = "Dark Chanting Goshawk" | sql_create_context |
CREATE TABLE Documents_with_expenses (
document_id VARCHAR,
budget_type_code VARCHAR
) | What are the document ids for the budget type code 'SF'? | SELECT document_id FROM Documents_with_expenses WHERE budget_type_code = 'SF' | 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... | provide the number of patients with diagnoses icd9 code 75733 who had delta abnormal lab test status. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.icd9_code = "75733" AND lab.flag = "delta" | mimicsql_data |
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 (
... | provide the number of patients whose admission year is less than 2139 and item id is 50893? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2139" AND lab.itemid = "50893" | mimicsql_data |
CREATE TABLE table_79894 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Attendance" real,
"Record" text
) | What was the record of the game that had a loss of Stottlemyre (10-12)? | SELECT "Record" FROM table_79894 WHERE "Loss" = 'stottlemyre (10-12)' | wikisql |
CREATE TABLE table_23216 (
"Institution" text,
"Location" text,
"Nickname" text,
"Founded" real,
"Type" text,
"Enrollment" real,
"Joined" real
) | What's the type of the school whose students' name is spirits? | SELECT "Type" FROM table_23216 WHERE "Nickname" = 'Spirits' | 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 diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE chartevent... | since 2101, what are the top four most frequently ordered laboratory tests for patients during the same month after they have been diagnosed with ac dvt/emb distl low ext? | SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t3.itemid FROM (SELECT t2.itemid, 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.hadm_id WHERE diagnoses_icd.i... | mimic_iii |
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE patient (
uniquepid text,
patientheal... | did patient 006-188114 get a vitamin b12 laboratory test during the first hospital visit? | SELECT COUNT(*) > 0 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-188114' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmit... | eicu |
CREATE TABLE weather (
date TEXT,
max_temperature_f INTEGER,
mean_temperature_f INTEGER,
min_temperature_f INTEGER,
max_dew_point_f INTEGER,
mean_dew_point_f INTEGER,
min_dew_point_f INTEGER,
max_humidity INTEGER,
mean_humidity INTEGER,
min_humidity INTEGER,
max_sea_level_pre... | I want a bar chart to show the average cloud cover of the dates that have the 5 highest cloud cover rates each year, and rank by the y axis from high to low. | SELECT date, AVG(cloud_cover) FROM weather ORDER BY AVG(cloud_cover) DESC | nvbench |
CREATE TABLE teachers (
LastName TEXT,
FirstName TEXT,
Classroom INTEGER
)
CREATE TABLE list (
LastName TEXT,
FirstName TEXT,
Grade INTEGER,
Classroom INTEGER
) | A scatter chart about what are the grade number and classroom number of each class in the list? | SELECT Classroom, Grade FROM list | nvbench |
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,
... | what were the five most common medications prescribed for patients who had previously been diagnosed with dka within 2 months, in 2102? | SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'dka' AND STRFTIME('%y', diagnosis.diagnosistime) =... | eicu |
CREATE TABLE table_50474 (
"Res." text,
"Record" text,
"Opponent" text,
"Method" text,
"Event" text,
"Round" real,
"Time" text,
"Location" text
) | What is the total number of Rounds held in Nevada, United States in which the time was 1:55? | SELECT COUNT("Round") FROM table_50474 WHERE "Location" = 'nevada, united states' AND "Time" = '1:55' | 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... | how many jewish patients were admitted to the hospital before year 2148? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.religion = "JEWISH" AND demographic.admityear < "2148" | mimicsql_data |
CREATE TABLE table_50664 (
"Team 1" text,
"Agg." text,
"Team 2" text,
"1st leg" text,
"2nd leg" text
) | WHAT IS THE 2ND LEG WITH TEAM 1 OF SPORTING? | SELECT "2nd leg" FROM table_50664 WHERE "Team 1" = 'sporting' | wikisql |
CREATE TABLE table_47354 (
"Date" text,
"Time" text,
"Opponent" text,
"Location" text,
"Score" text
) | Where was the September 22 game played? | SELECT "Location" FROM table_47354 WHERE "Date" = 'september 22' | wikisql |
CREATE TABLE table_name_76 (
year VARCHAR,
name VARCHAR
) | What is the total number of years that prof. aditya naraian purohit won? | SELECT COUNT(year) FROM table_name_76 WHERE name = "prof. aditya naraian purohit" | sql_create_context |
CREATE TABLE table_70136 (
"Stage" text,
"Winner" text,
"General classification" text,
"Points classification" text,
"Mountains classification" text,
"Trofeo Fast Team" text
) | Which stage has a mountains classification of Mariano Piccoli and was won by Giuseppe Citterio? | SELECT "Stage" FROM table_70136 WHERE "Mountains classification" = 'mariano piccoli' AND "Winner" = 'giuseppe citterio' | wikisql |
CREATE TABLE PostNotices (
Id number,
PostId number,
PostNoticeTypeId number,
CreationDate time,
DeletionDate time,
ExpiryDate time,
Body text,
OwnerUserId number,
DeletionUserId number
)
CREATE TABLE PostsWithDeleted (
Id number,
PostTypeId number,
AcceptedAnswerId numb... | Procurar Merchandising Feito pelo Daniel. | SELECT Comments.PostId, Comments.Text AS "Coment rio" FROM Comments WHERE Comments.UserId = 4816 | sede |
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 ... | 列出患者吕高义所有检验结果指标记录在2011-05-12到2018-09-25这七年内的检测人为窦文茵的检验指标流水号是多少? | SELECT jyjgzbb.JYZBLSH 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 = ... | css |
CREATE TABLE papers (
paperid number,
title text
)
CREATE TABLE authorship (
authid number,
instid number,
paperid number,
authorder number
)
CREATE TABLE inst (
instid number,
name text,
country text
)
CREATE TABLE authors (
authid number,
lname text,
fname text
) | Which papers did the author 'Olin Shivers' write? Give me the paper titles. | SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Olin" AND t1.lname = "Shivers" | spider |
CREATE TABLE table_33930 (
"Model Number" text,
"Stepping" text,
"Frequency" text,
"L2 Cache" text,
"Multi 1" text,
"V Core" text,
"Socket" text,
"Release Date" text,
"Part Number(s)" text
) | When is the release date for a chip that has a Frequency of 2300mhz? | SELECT "Release Date" FROM table_33930 WHERE "Frequency" = '2300mhz' | wikisql |
CREATE TABLE table_name_67 (
player VARCHAR,
country VARCHAR,
to_par VARCHAR,
score VARCHAR
) | What United States Player has a To par of +4 and a Score of 71-77=148? | SELECT player FROM table_name_67 WHERE country = "united states" AND to_par = "+4" AND score = 71 - 77 = 148 | sql_create_context |
CREATE TABLE table_203_734 (
id number,
"year" number,
"competition" text,
"venue" text,
"position" text,
"event" text,
"notes" text
) | in what year was civallero 's first listed achievement ? | SELECT "year" FROM table_203_734 WHERE id = 1 | squall |
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code tex... | calculate the duration of patient 013-12480's stay in the first icu. | SELECT STRFTIME('%j', patient.unitdischargetime) - STRFTIME('%j', patient.unitadmittime) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-12480') AND NOT patient.unitadmittime IS NULL ORDER BY patient.unitadmittime LIMIT 1 | eicu |
CREATE TABLE university (
School_ID int,
School text,
Location text,
Founded real,
Affiliation text,
Enrollment real,
Nickname text,
Primary_conference text
)
CREATE TABLE basketball_match (
Team_ID int,
School_ID int,
Team_Name text,
ACC_Regular_Season text,
ACC_Per... | Show me about the distribution of All_Neutral and ACC_Percent in a bar chart, sort by the Y-axis in asc. | SELECT All_Neutral, ACC_Percent FROM basketball_match ORDER BY ACC_Percent | nvbench |
CREATE TABLE wdmzjzjlb (
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... | 列出在2003年10月24日到2017年4月14日内患者曹诗蕾被开出多少检验报告单的检验报告单号? | SELECT jybgb.BGDH FROM person_info JOIN hz_info JOIN wdmzjzjlb JOIN jybgb 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 AND wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE person_info.XM = '曹... | css |
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
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 is the total volume of output patient 28484 had on the first icu visit? | SELECT SUM(outputevents.value) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 28484) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1) | mimic_iii |
CREATE TABLE table_1342359_2 (
first_elected INTEGER
) | What is the last year that someone is first elected? | SELECT MAX(first_elected) FROM table_1342359_2 | sql_create_context |
CREATE TABLE comment_instructor (
instructor_id int,
student_id int,
score int,
comment_text varchar
)
CREATE TABLE student_record (
student_id int,
course_id int,
semester int,
grade varchar,
how varchar,
transfer_source varchar,
earn_credit varchar,
repeat_term varchar... | Is there a lab for 527 ? | SELECT COUNT(*) > 0 FROM course WHERE department = 'EECS' AND has_lab = 'Y' AND number = 527 | advising |
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 admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dis... | indicate the daily maximum amount of heart rate for patient 12367 during their last hospital encounter. | SELECT MAX(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 = 12367 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1)) AND chart... | mimic_iii |
CREATE TABLE table_25126 (
"Series #" real,
"Season #" real,
"Episode title" text,
"Written by" text,
"Directed by" text,
"U.S. viewers (millions)" text,
"Original air date" text
) | What is the original air date where tracy poust & jon kinnally was written by? | SELECT "Original air date" FROM table_25126 WHERE "Written by" = 'Tracy Poust & Jon Kinnally' | wikisql |
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,
... | 周兴业这位病人在04.2.7到17.11.24的就诊结算日期内,一共有多少医疗就诊记录编号,把这些编号都列出来 | SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 JOIN t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE t_kc21.PERSON_NM = '周兴业' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2004-02-07' AND '2017-11-24' | css |
CREATE TABLE table_202_28 (
id number,
"year" number,
"output growth rate %" number,
"unemployment rate %" number,
"inflation rate %" number
) | what year saw the highest output growth rate in japan between the years 1990 and 2004 ? | SELECT "year" FROM table_202_28 WHERE "year" >= 1990 AND "year" <= 2004 ORDER BY "output growth rate %" DESC LIMIT 1 | squall |
CREATE TABLE table_name_23 (
college VARCHAR,
player VARCHAR
) | What college did delray brooks go to? | SELECT college FROM table_name_23 WHERE player = "delray brooks" | sql_create_context |
CREATE TABLE table_40441 (
"Year" real,
"Series" text,
"Winning team" text,
"Losing team" text,
"Score" text,
"Site" text
) | Who won the series when the San Francisco Giants lost? | SELECT "Winning team" FROM table_40441 WHERE "Losing team" = 'san francisco giants' | wikisql |
CREATE TABLE table_42373 (
"Name" text,
"Novelty" text,
"Status" text,
"Authors" text,
"Location" text
) | What is the novel that has a valid status, located in Mongolia, and named Prenocephale? | SELECT "Novelty" FROM table_42373 WHERE "Status" = 'valid' AND "Location" = 'mongolia' AND "Name" = 'prenocephale' | wikisql |
CREATE TABLE table_26041144_11 (
rank VARCHAR,
average VARCHAR
) | What is the rank of the player with the 39.69 average? | SELECT rank FROM table_26041144_11 WHERE average = "39.69" | sql_create_context |
CREATE TABLE table_20211 (
"#" real,
"Season" real,
"Bowl game" text,
"Result" text,
"Opponent" text,
"Stadium" text,
"Location" text,
"Attendance" text
) | What is the highest season for a bowl game of the 1993 Independence Bowl? | SELECT MAX("Season") FROM table_20211 WHERE "Bowl game" = '1993 Independence Bowl' | wikisql |
CREATE TABLE table_43863 (
"Match No." real,
"Date" text,
"Time" text,
"Score" text,
"Venue" text,
"Match Report" text
) | Name the Score which has a Time of 18:00 and a Venue of african union? | SELECT "Score" FROM table_43863 WHERE "Time" = '18:00' AND "Venue" = 'african union' | wikisql |
CREATE TABLE Invoices (
invoice_number INTEGER,
order_id INTEGER,
invoice_date DATETIME
)
CREATE TABLE Products (
product_id INTEGER,
parent_product_id INTEGER,
production_type_code VARCHAR(15),
unit_price DECIMAL(19,4),
product_name VARCHAR(80),
product_color VARCHAR(20),
produ... | Show first name and id for all customers with at least 2 accounts. Show bar chart. | SELECT T2.customer_first_name, T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id | nvbench |
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,
... | 知道哪些人参与了04488736077这次医疗就诊吗?请列出这些人员的姓名、性别、年龄和公民身份号码 | SELECT t_kc21.PERSON_NM, t_kc21.PERSON_SEX, t_kc21.PERSON_AGE, t_kc21.IDENTITY_CARD FROM t_kc21 WHERE t_kc21.MED_CLINIC_ID = '65250841483' | css |
CREATE TABLE table_name_9 (
date VARCHAR,
sub_total VARCHAR
) | On which day were the subtotal hours 9:30? | SELECT date FROM table_name_9 WHERE sub_total = "9:30" | sql_create_context |
CREATE TABLE table_70317 (
"Date" text,
"Opponent" text,
"Home/Away" text,
"Field" text,
"Result" text
) | What is the result when you play at home against Pride | SELECT "Result" FROM table_70317 WHERE "Home/Away" = 'home' AND "Opponent" = 'pride' | wikisql |
CREATE TABLE table_28068063_3 (
eliminated_from_competition VARCHAR,
proceed_to_quarter_final VARCHAR
) | Who was eliminated from the competition when pau proceed to the quarter final? | SELECT eliminated_from_competition FROM table_28068063_3 WHERE proceed_to_quarter_final = "Pau" | sql_create_context |
CREATE TABLE table_name_39 (
tournament VARCHAR
) | Which 2008 has a 2009 of A, and a Tournament of cincinnati masters? | SELECT 2008 FROM table_name_39 WHERE 2009 = "a" AND tournament = "cincinnati masters" | sql_create_context |
CREATE TABLE table_name_30 (
game INTEGER,
series VARCHAR
) | Which Game has a Series of bruins lead 3 1? | SELECT SUM(game) FROM table_name_30 WHERE series = "bruins lead 3–1" | sql_create_context |
CREATE TABLE table_67701 (
"Week" real,
"Date" text,
"Visiting Team" text,
"Host Team" text,
"Stadium" text
) | What was the stadium for the game held on October 31? | SELECT "Stadium" FROM table_67701 WHERE "Date" = 'october 31' | 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 demographic (
subject_id text,
hadm_id t... | what is the number of patients whose admission type is elective and lab test fluid is urine? | 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.fluid = "Urine" | mimicsql_data |
CREATE TABLE hz_info (
KH text,
KLX number,
YLJGDM text,
RYBH text
)
CREATE TABLE person_info (
RYBH text,
XBDM number,
XBMC text,
XM text,
CSRQ time,
CSD text,
MZDM text,
MZMC text,
GJDM text,
GJMC text,
JGDM text,
JGMC text,
XLDM text,
XLMC text... | 有哪些检验指标记录的检测指标名称、检测指标结果定量以及检测指标结果定量单位和检验指标34772663732这个记录都相同? | SELECT * FROM jyjgzbb WHERE JCZBMC = (SELECT JCZBMC FROM jyjgzbb WHERE JYZBLSH = '34772663732') AND JCZBJGDW = (SELECT JCZBJGDW FROM jyjgzbb WHERE JYZBLSH = '34772663732') AND JCZBJGDL = (SELECT JCZBJGDL FROM jyjgzbb WHERE JYZBLSH = '34772663732') | css |
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAddress text
)
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Descr... | South African Users by Location. | SELECT Location, COUNT(*) AS number FROM Users WHERE Location LIKE '%South Africa%' OR Location LIKE '%Cape Town%' OR Location LIKE '%Capetown%' OR Location LIKE '%Joburg%' OR Location LIKE '%Johannesburg%' OR Location LIKE '%JHB%' OR Location LIKE '%Gauteng%' OR Location LIKE '%Pretoria%' OR Location LIKE '%Western Ca... | sede |
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... | 编号为85512169的参保人年门诊医疗费一共多少钱? | SELECT SUM(MED_AMOUT) FROM t_kc21 WHERE PERSON_ID = '85512169' AND CLINIC_TYPE = '门诊' | css |
CREATE TABLE table_54111 (
"Driver" text,
"Constructor" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
) | What is the smallest grid for Ayrton Senna? | SELECT MIN("Grid") FROM table_54111 WHERE "Driver" = 'ayrton senna' | wikisql |
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_type text,
admission_location text,
discharge_location text,
insurance text,
language text,
marital_status text,
ethnicity text,
age number
)
CREATE ... | what is the maximum total cost of a hospital involving a laboratory test for uric acid, urine since 5 years ago? | SELECT MAX(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'uric acid, urine')) AND DATETIME(cost.chargetime) >= DATETIME(CURRENT_TIME(), '-5 year') GROUP BY cos... | mimic_iii |
CREATE TABLE table_name_59 (
earnings___$__ VARCHAR,
tournaments_played VARCHAR,
year VARCHAR
) | What 2012 amount of earnings corresponds with less than 28 tournaments played? | SELECT earnings___$__ FROM table_name_59 WHERE tournaments_played < 28 AND year = "2012" | sql_create_context |
CREATE TABLE person_info (
RYBH text,
XBDM number,
XBMC text,
XM text,
CSRQ time,
CSD text,
MZDM text,
MZMC text,
GJDM text,
GJMC text,
JGDM text,
JGMC text,
XLDM text,
XLMC text,
ZYLBDM text,
ZYMC text
)
CREATE TABLE hz_info (
KH text,
KLX number... | 2007年8月19日到2009年5月22日内患者34105919被开出了多少检验报告单 | SELECT (SELECT COUNT(*) 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.RYBH = '34105919' AND jybgb.BGRQ BETWEEN '2007-08-19' AND '2009-05-22'... | css |
CREATE TABLE table_43521 (
"School" text,
"Bask" real,
"Golf" text,
"Soccer" text,
"Soft" text,
"Swimming" text,
"Tennis" real,
"Indoor track" text,
"Outdoor track" text,
"Volleyball" text,
"Total" real
) | Which Bask has Soft of 18, and a Total larger than 35? | SELECT AVG("Bask") FROM table_43521 WHERE "Soft" = '18' AND "Total" > '35' | wikisql |
CREATE TABLE table_51767 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What was the attendance at Moorabbin Oval? | SELECT AVG("Crowd") FROM table_51767 WHERE "Venue" = 'moorabbin oval' | wikisql |
CREATE TABLE table_27383390_4 (
date_of_appointment VARCHAR,
position_in_table VARCHAR
) | When is the date of appointment when the position in table is 16? | SELECT date_of_appointment FROM table_27383390_4 WHERE position_in_table = 16 | sql_create_context |
CREATE TABLE weather (
date TEXT,
max_temperature_f INTEGER,
mean_temperature_f INTEGER,
min_temperature_f INTEGER,
max_dew_point_f INTEGER,
mean_dew_point_f INTEGER,
min_dew_point_f INTEGER,
max_humidity INTEGER,
mean_humidity INTEGER,
min_humidity INTEGER,
max_sea_level_pre... | What are the dates in which the mean sea level pressure was between 303 and 31, and count them by a line chart, list from low to high by the date. | SELECT date, COUNT(date) FROM weather WHERE mean_sea_level_pressure_inches BETWEEN 30.3 AND 31 GROUP BY date ORDER BY date | nvbench |
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, show me about the distribution of phone_number and salary in a bar chart, show SALARY in asc order. | SELECT PHONE_NUMBER, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SALARY | nvbench |
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... | what was the name of the intake that patient 017-83061 until 943 days ago last had? | SELECT intakeoutput.celllabel FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-83061')) AND intakeoutput.cellpath LIKE '%intake%' AND D... | eicu |
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... | calculate the number of patients born before 1879 ere tranferred within the facility. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND demographic.dob_year < "1879" | mimicsql_data |
CREATE TABLE table_202_45 (
id number,
"rank" number,
"wrestler" text,
"no. of reigns" number,
"combined days" number
) | how long did orville brown remain nwa world heavyweight champion ? | SELECT "combined days" FROM table_202_45 WHERE "wrestler" = 'orville brown' | squall |
CREATE TABLE table_2570269_2 (
cast VARCHAR,
episode__number VARCHAR
) | For episode number 2-03, what are the names of the cast? | SELECT cast FROM table_2570269_2 WHERE episode__number = "2-03" | sql_create_context |
CREATE TABLE flight (
id int,
Vehicle_Flight_number text,
Date text,
Pilot text,
Velocity real,
Altitude real,
airport_id int,
company_id int
)
CREATE TABLE operate_company (
id int,
name text,
Type text,
Principal_activities text,
Incorporated_in text,
Group_Equ... | How many companies that have ever operated a flight for each type? Draw a bar chart. | SELECT Type, COUNT(Type) FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id GROUP BY Type | 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 d_icd_diagnoses (
row_id number,
icd9_code text,
sh... | when was last time patient 9038 was prescribed a medication via right eye route in 04/last year? | SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 9038) AND prescriptions.route = 'right eye' AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME... | mimic_iii |
CREATE TABLE table_26669939_1 (
no_of_athletes VARCHAR,
host_city VARCHAR
) | What was the number of athletes in the host city of Nice? | SELECT no_of_athletes FROM table_26669939_1 WHERE host_city = "Nice" | sql_create_context |
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,0)
)
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,... | For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the distribution of hire_date and the amount of hire_date bin hire_date by weekday in a bar chart, and sort in ascending by the total number please. | SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY COUNT(HIRE_DATE) | nvbench |
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId number,
CreationDate time,
BountyAmount number
)
CREATE TABLE PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number,
LinkTypeId number
)
CREATE TABLE TagSynonyms (
Id number... | Question score vs. highest voted Answer score. | SELECT q.Score AS "q-score", a.Score AS "a-score" FROM Posts AS q INNER JOIN (SELECT DISTINCT a.ParentId, MAX(a.Score) AS "score" FROM Posts AS a WHERE a.PostTypeId = 2 GROUP BY a.ParentId) AS a ON q.Id = a.ParentId WHERE q.PostTypeId = 1 AND q.ClosedDate IS NULL | sede |
CREATE TABLE table_42794 (
"Name" text,
"Innings" real,
"Runs Scored" real,
"Balls Faced" real,
"Average" real,
"S.R." real
) | Which S.R. has a Average smaller than 23.63 Runs Scored of 49? | SELECT "S.R." FROM table_42794 WHERE "Average" < '23.63' AND "Runs Scored" = '49' | wikisql |
CREATE TABLE table_13657749_2 (
results VARCHAR,
gto_winning_team VARCHAR
) | What is Peter Gregg Hurley Haywood's results? | SELECT results FROM table_13657749_2 WHERE gto_winning_team = "Peter Gregg Hurley Haywood" | sql_create_context |
CREATE TABLE table_name_52 (
category VARCHAR,
work VARCHAR,
award VARCHAR
) | What category was Scream nominated for at the International Horror Guild? | SELECT category FROM table_name_52 WHERE work = "scream" AND award = "international horror guild" | sql_create_context |
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE TagSynonyms (
Id number,
SourceTagName text,
TargetTagName text,
CreationDate time,
OwnerUserId number,
AutoRenameCount number,
LastAutoRename time,
Score number,
ApprovedByUserId numbe... | List all questions by a user. | SELECT * FROM Posts WHERE OwnerUserId = @UserId AND PostTypeId = 1 | sede |
CREATE TABLE table_name_49 (
mwehl_team VARCHAR,
round VARCHAR,
player VARCHAR
) | What is the MWEHL Team on Round 2, with player Nicolas Kerdiles? | SELECT mwehl_team FROM table_name_49 WHERE round = "2" AND player = "nicolas kerdiles" | sql_create_context |
CREATE TABLE table_name_33 (
result VARCHAR,
opponent VARCHAR
) | What was the result when the new england patriots played? | SELECT result FROM table_name_33 WHERE opponent = "new england patriots" | sql_create_context |
CREATE TABLE table_24605 (
"Week" real,
"Date" text,
"Opponent" text,
"Location" text,
"Final Score" text,
"Attendance" real,
"Record" text
) | What was the location for when the opponent was @ roughriders? | SELECT "Location" FROM table_24605 WHERE "Opponent" = '@ Roughriders' | wikisql |
CREATE TABLE table_name_16 (
county VARCHAR,
enrollment VARCHAR
) | Which County has an Enrollment of 297? | SELECT county FROM table_name_16 WHERE enrollment = 297 | sql_create_context |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.