context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE music_festival (
id number,
music_festival text,
date_of_ceremony text,
category text,
volume number,
result text
)
CREATE TABLE volume (
volume_id number,
volume_issue text,
issue_date text,
weeks_on_top number,
song text,
artist_id number
)
CREATE TABLE a... | Return the result that is most frequent at music festivals. | SELECT result FROM music_festival GROUP BY result ORDER BY COUNT(*) DESC LIMIT 1 | spider |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE prescriptions... | what is the number of patients whose admission type is elective and drug type is additive? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND prescriptions.drug_type = "ADDITIVE" | mimicsql_data |
CREATE TABLE person_info (
CSD text,
CSRQ time,
GJDM text,
GJMC text,
JGDM text,
JGMC text,
MZDM text,
MZMC text,
RYBH text,
XBDM number,
XBMC text,
XLDM text,
XLMC text,
XM text,
ZYLBDM text,
ZYMC text
)
CREATE TABLE zyjzjlb (
CYBQDM text,
CYBQMC... | 83368624588住院就诊中,查询门诊的中医诊断的编号 | SELECT zyjzjlb.MZZYZDZZBM FROM zyjzjlb WHERE zyjzjlb.JZLSH = '83368624588' | css |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wa... | count the number of patients who had undergone administration of electrolytes - intravenous two or more times until 3 years ago. | SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, COUNT(*) AS c1 FROM patient WHERE patient.patientunitstayid = (SELECT treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'administration of electrolytes - intravenous' AND DATETIME(treatment.treatmenttime) <= DATETIME(CURRENT_TI... | eicu |
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE cost (
row_id number,
subject_id n... | what is patient 31306's yearly maximum white blood cells level since 41 months ago? | SELECT MAX(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 31306) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'white blood cells') AND DATETIME(labevents.charttime) >= DATETIME(CURRENT_T... | mimic_iii |
CREATE TABLE table_name_20 (
outcome VARCHAR,
partner VARCHAR
) | What is the Outcome when the partner was kristof vliegen? | SELECT outcome FROM table_name_20 WHERE partner = "kristof vliegen" | sql_create_context |
CREATE TABLE jybgb (
BBCJBW text,
BBDM text,
BBMC text,
BBZT number,
BGDH text,
BGJGDM text,
BGJGMC text,
BGRGH text,
BGRQ time,
BGRXM text,
BGSJ time,
CJRQ time,
JSBBRQSJ time,
JSBBSJ time,
JYBBH text,
JYJGMC text,
JYJSGH text,
JYJSQM text,
JY... | 名叫俞欣怡的病人在01年1月29日到2014年9月27日期间被开出的所有检验报告单的科室编码以及名称分别叫什么? | SELECT jybgb.KSBM, jybgb.KSMC 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_... | css |
CREATE TABLE chartevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE transfers (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
eventtype tex... | list the top five most frequent diagnoses that patients are diagnosed with within the same hospital visit after undergoing a coronar arteriogr-2 cath in 2105. | 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, admissions.hadm_id FROM procedures_icd JOIN admissions ON procedures_i... | mimic_iii |
CREATE TABLE match_result (
Rank int,
Club_ID int,
Gold int,
Big_Silver int,
Small_Silver int,
Bronze int,
Points int
)
CREATE TABLE player (
Player_ID int,
Sponsor_name text,
Player_name text,
Gender text,
Residence text,
Occupation text,
Votes int,
Rank tex... | Bar chart x axis occupation y axis the total number, and show in ascending by the bar. | SELECT Occupation, COUNT(*) FROM player GROUP BY Occupation ORDER BY Occupation | nvbench |
CREATE TABLE stadium (
ID int,
name text,
Capacity int,
City text,
Country text,
Opening_year int
)
CREATE TABLE record (
ID int,
Result text,
Swimmer_ID int,
Event_ID int
)
CREATE TABLE swimmer (
ID int,
name text,
Nationality text,
meter_100 real,
meter_20... | Find meter_300 and ID , and visualize them by a bar chart. | SELECT meter_300, ID FROM swimmer | nvbench |
CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15),
Document_Type_Name VARCHAR(255),
Document_Type_Description VARCHAR(255)
)
CREATE TABLE Statements (
Statement_ID INTEGER,
Statement_Details VARCHAR(255)
)
CREATE TABLE Ref_Budget_Codes (
Budget_Type_Code CHAR(15),
Budget_Type_D... | Show the average of account details for different statement details in a bar chart, and display the average of account details in descending order. | SELECT Statement_Details, AVG(Account_Details) FROM Accounts AS T1 JOIN Statements AS T2 ON T1.Statement_ID = T2.Statement_ID GROUP BY Statement_Details ORDER BY AVG(Account_Details) DESC | nvbench |
CREATE TABLE table_63623 (
"Elector" text,
"Nationality" text,
"Cardinalatial order and title" text,
"Elevated" text,
"Elevator" text
) | What was the date of elevation for the cardinal given the order and title of Cardinal-Priest of S. Pudenziana? | SELECT "Elevated" FROM table_63623 WHERE "Cardinalatial order and title" = 'cardinal-priest of s. pudenziana' | wikisql |
CREATE TABLE table_29225103_2 (
hp_winning_team VARCHAR,
ep_winning_team VARCHAR,
gm_winning_team VARCHAR
) | Who was the HP winning team when the EP winning team was Hans Zereis and the GM winning team was Charles Gibson? | SELECT hp_winning_team FROM table_29225103_2 WHERE ep_winning_team = "Hans Zereis" AND gm_winning_team = "Charles Gibson" | sql_create_context |
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE Comments (
Id number,
PostId number,
Score number,
Text text,
CreationDate time,
UserD... | Top 1000 users of india and pakistan. | SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation, LOWER(Location) AS CNTRY FROM Users WHERE LOWER(Location) IN ('india', 'pakistan') ORDER BY Reputation DESC LIMIT 10000 | sede |
CREATE TABLE table_74976 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Attendance" text,
"Record" text
) | What was the Indians record during the game that had 19,823 fans attending? | SELECT "Record" FROM table_74976 WHERE "Attendance" = '19,823' | wikisql |
CREATE TABLE table_32970 (
"Outcome" text,
"Date" real,
"Championship" text,
"Surface" text,
"Opponent in the final" text,
"Score in the final" text
) | Against Opponent in the Final Ivan Lendl, on a Surface of clay, with an Outcome of runner-up, where was the Championship? | SELECT "Championship" FROM table_32970 WHERE "Outcome" = 'runner-up' AND "Surface" = 'clay' AND "Opponent in the final" = 'ivan lendl' | wikisql |
CREATE TABLE Ship (
Ship_ID int,
Name text,
Type text,
Built_Year real,
Class text,
Flag text
)
CREATE TABLE captain (
Captain_ID int,
Name text,
Ship_ID int,
age text,
Class text,
Rank text
) | Show me the total number of the flag of ships that are not steered by any captain with Midshipman rank using a bar graph, and display x axis in descending order. | SELECT Flag, COUNT(Flag) FROM Ship WHERE NOT Ship_ID IN (SELECT Ship_ID FROM captain WHERE Rank = 'Midshipman') GROUP BY Flag ORDER BY Flag DESC | nvbench |
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | What is the procedure short title of Paul Edwards? | SELECT procedures.short_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.name = "Paul Edwards" | mimicsql_data |
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,0)
)
CREATE TABLE locations (
LOCATION_ID decimal(4,0),
STREET_ADDRESS varchar(40),
POSTAL_CODE varchar(12),
CITY varchar(30),
STATE_PROVINCE varchar(25),
COUNTRY_ID varc... | For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, draw a bar chart about the distribution of job_id and the average of department_id , and group by attribute job_id, and I want to show from low to high by the names. | SELECT JOB_ID, AVG(DEPARTMENT_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID ORDER BY JOB_ID | nvbench |
CREATE TABLE Customers (
Customer_ID INTEGER,
Customer_Details VARCHAR(255)
)
CREATE TABLE Payments (
Payment_ID INTEGER,
Settlement_ID INTEGER,
Payment_Method_Code VARCHAR(255),
Date_Payment_Made DATE,
Amount_Payment INTEGER
)
CREATE TABLE Customer_Policies (
Policy_ID INTEGER,
Cu... | Bin the claim date into the Year interval and count them for visualizing a bar chart, and show in desc by the y-axis. | SELECT Date_Claim_Made, COUNT(Date_Claim_Made) FROM Settlements ORDER BY COUNT(Date_Claim_Made) DESC | nvbench |
CREATE TABLE table_name_82 (
candidate VARCHAR,
share_of_votes VARCHAR
) | Which candidate won 61.47% of the votes? | SELECT candidate FROM table_name_82 WHERE share_of_votes = "61.47%" | 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... | count the number of patients whose gender is f and admission type is emergency? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.admission_type = "EMERGENCY" | mimicsql_data |
CREATE TABLE table_62603 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text,
"Money ( $ )" real
) | What is Player, when Country is 'United States', and when Place is '6'? | SELECT "Player" FROM table_62603 WHERE "Country" = 'united states' AND "Place" = '6' | wikisql |
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... | 编码为2768334的医院科室的最长医疗住院时长少于16天有几个? | SELECT COUNT(*) FROM (SELECT t_kc21.MED_ORG_DEPT_CD FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '2768334' GROUP BY t_kc21.MED_ORG_DEPT_CD HAVING MAX(t_kc21.IN_HOSP_DAYS) < 16) AS T | css |
CREATE TABLE table_203_9 (
id number,
"state" text,
"last execution date" text,
"name" text,
"crime" text,
"method" text
) | alabama last put someone to death in 2013 what was its means of execution ? | SELECT "method" FROM table_203_9 WHERE "state" = 'alabama' | squall |
CREATE TABLE table_78583 (
"Season" text,
"Division North" text,
"Division South" text,
"Division East" text,
"Division West" text,
"Division Southwest" text
) | Who won Division West when Division North was won by Alumina? | SELECT "Division West" FROM table_78583 WHERE "Division North" = 'alumina' | wikisql |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id t... | give me the number of patients whose admission year is less than 2114 and item id is 50806? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2114" AND lab.itemid = "50806" | mimicsql_data |
CREATE TABLE table_26389 (
"Branding" text,
"Callsign" text,
"Frequency" text,
"Power kW" text,
"Coverage" text
) | What is the radio station branding when the power km is 5kw? | SELECT "Branding" FROM table_26389 WHERE "Power kW" = '5kW' | wikisql |
CREATE TABLE table_75901 (
"Date" text,
"Time" text,
"Home" text,
"Away" text,
"Score" text,
"Ground" text
) | Who was the home team of the game at the time of 15:00? | SELECT "Home" FROM table_75901 WHERE "Time" = '15:00' | wikisql |
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 (... | what is the number of patients whose primary disease is stemi and year of death is less than or equal to 2111? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "STEMI" AND demographic.dod_year <= "2111.0" | mimicsql_data |
CREATE TABLE table_31570 (
"Number" real,
"Minister" text,
"Took office" text,
"Left office" text,
"Government" text,
"Party" text
) | Who is the mInister who left office during 1960? | SELECT "Minister" FROM table_31570 WHERE "Left office" = '1960' | wikisql |
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
amount number
)
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE d_icd_procedures ... | when did patient 14397 get the d5w last time? | SELECT inputevents_cv.charttime FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 14397)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label... | mimic_iii |
CREATE TABLE table_34979 (
"City" text,
"Country" text,
"IATA" text,
"ICAO" text,
"Airport" text
) | For an IATA of MLE, what is the ICAO? | SELECT "ICAO" FROM table_34979 WHERE "IATA" = 'mle' | wikisql |
CREATE TABLE table_59123 (
"Tie no" text,
"Home team" text,
"Score" text,
"Away team" text,
"Date" text
) | What is the Tie no when Crystal Palace is the Away team? | SELECT "Tie no" FROM table_59123 WHERE "Away team" = 'crystal palace' | wikisql |
CREATE TABLE table_76543 (
"Year" real,
"Date" text,
"Race name" text,
"Winner" text,
"Engine" text
) | Which race did Bill Holland win in 1946? | SELECT "Race name" FROM table_76543 WHERE "Year" = '1946' AND "Winner" = 'bill holland' | wikisql |
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 text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
... | what is minimum age of patients whose gender is f and age is greater than or equal to 27? | SELECT MIN(demographic.age) FROM demographic WHERE demographic.gender = "F" AND demographic.age >= "27" | mimicsql_data |
CREATE TABLE program (
program_id int,
name varchar,
college varchar,
introduction varchar
)
CREATE TABLE comment_instructor (
instructor_id int,
student_id int,
score int,
comment_text varchar
)
CREATE TABLE offering_instructor (
offering_instructor_id int,
offering_id int,
... | Next Winter is Prof. Simon Wojczyszyn teaching 445 ? | SELECT COUNT(*) > 0 FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number = 445 AND instructor.name LIKE '%Simon Wojczyszyn%' AND offering_instructor.instructor_id = instructor.instructor_id AND offerin... | advising |
CREATE TABLE t_kc22 (
MED_EXP_DET_ID text,
OVERALL_CD_ORG text,
OVERALL_CD_PERSON text,
MED_CLINIC_ID text,
MED_EXP_BILL_ID text,
SOC_SRT_DIRE_CD text,
SOC_SRT_DIRE_NM text,
DIRE_TYPE number,
CHA_ITEM_LEV number,
MED_INV_ITEM_TYPE text,
MED_DIRE_CD text,
MED_DIRE_NM text,... | 从01年7月3日开始到18年10月2日结束编号为6425807的医院门诊医疗记录的数量总共有多少? | SELECT COUNT(*) FROM t_kc21 WHERE MED_SER_ORG_NO = '6425807' AND IN_HOSP_DATE BETWEEN '2001-07-03' AND '2018-10-02' AND CLINIC_TYPE = '门诊' | css |
CREATE TABLE table_204_99 (
id number,
"#" number,
"club" text,
"winner" number,
"last win" number,
"runner-up" number,
"last losing final" number
) | what club is before saipa ? | SELECT "club" FROM table_204_99 WHERE id = (SELECT id FROM table_204_99 WHERE "club" = 'saipa') - 1 | squall |
CREATE TABLE table_name_65 (
year INTEGER,
sideline_reporters VARCHAR
) | What's the average year that sara orlesky and farhan lalji are the sideline reporters? | SELECT AVG(year) FROM table_name_65 WHERE sideline_reporters = "sara orlesky and farhan lalji" | sql_create_context |
CREATE TABLE table_2528382_2 (
Co VARCHAR,
singers VARCHAR,
movie_album VARCHAR
) | Which co-singers appear in the movie Pyaasa? | SELECT Co - singers FROM table_2528382_2 WHERE movie_album = "Pyaasa" | sql_create_context |
CREATE TABLE table_name_59 (
location VARCHAR,
college_name VARCHAR
) | What is the location of the kanyakumari government medical college? | SELECT location FROM table_name_59 WHERE college_name = "kanyakumari government medical college" | sql_create_context |
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
CREATE TABLE locations (
LOCATION_ID decimal(4,0),
STREET_ADDRESS varchar(40),
POSTAL_CODE varchar(12),
CITY varchar(30),
STATE_PROVINCE varchar(25),
COUNTRY_ID varchar(2)
)
CREATE TABLE countries (
COUNTRY_ID... | For those employees who did not have any job in the past, find job_id and the sum of employee_id , and group by attribute job_id, and visualize them by a bar chart, list by the JOB_ID from high to low. | SELECT JOB_ID, SUM(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY JOB_ID DESC | nvbench |
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... | Count the number of patients who died in or before 2186 and had a chordae tendineae operation. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2186.0" AND procedures.short_title = "Chordae tendineae ops" | mimicsql_data |
CREATE TABLE table_name_80 (
points_against VARCHAR,
drawn VARCHAR,
points VARCHAR
) | What is Points Against, when Drawn is '2', and when Points Of is '32'? | SELECT points_against FROM table_name_80 WHERE drawn = "2" AND points = "32" | sql_create_context |
CREATE TABLE table_70297 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Attendance" real,
"Record" text
) | Name the record for august 28 | SELECT "Record" FROM table_70297 WHERE "Date" = 'august 28' | wikisql |
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
VoteTypeId number,
CreationD... | Number of questions closed as duplicates. | SELECT YEAR(Posts.CreationDate), COUNT(Posts.Id) FROM Posts INNER JOIN PostHistory AS PH ON PH.PostId = Posts.Id WHERE Posts.PostTypeId = @question AND PH.PostHistoryTypeId = @closed AND CAST(PH.Comment AS TEXT) IN ('1', '101') GROUP BY YEAR(Posts.CreationDate) ORDER BY YEAR(Posts.CreationDate) | sede |
CREATE TABLE fgwyjzb (
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,
... | 潘天蓝患者在医院0395177做过的出院诊断结果中,把出院诊断医生姓柳的诊断记录列出来 | SELECT gwyjzb.OUT_DIAG_DIS_CD, gwyjzb.OUT_DIAG_DIS_NM FROM gwyjzb WHERE gwyjzb.PERSON_NM = '潘天蓝' AND gwyjzb.MED_SER_ORG_NO = '0395177' AND gwyjzb.OUT_DIAG_DOC_NM LIKE '柳%' UNION SELECT fgwyjzb.OUT_DIAG_DIS_CD, fgwyjzb.OUT_DIAG_DIS_NM FROM fgwyjzb WHERE fgwyjzb.PERSON_NM = '潘天蓝' AND fgwyjzb.MED_SER_ORG_NO = '0395177' AN... | 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 lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,... | what is the number of patients whose diagnoses icd9 code is 99659 and drug route is id? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "99659" AND prescriptions.route = "ID" | mimicsql_data |
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9cod... | what was patient 009-12221's sao2 for the first time since 05/23/2101? | SELECT vitalperiodic.sao2 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-12221')) AND NOT vitalperiodic.sao2 IS NULL AND STRFTIME('... | eicu |
CREATE TABLE table_name_56 (
drawn VARCHAR,
club VARCHAR
) | What was drawn for llanishen rfc? | SELECT drawn FROM table_name_56 WHERE club = "llanishen rfc" | sql_create_context |
CREATE TABLE table_14118521_1 (
primary_payload_s_ VARCHAR,
launch_date VARCHAR
) | what's the primary payload(s) with launch date being july 8, 1994 | SELECT primary_payload_s_ FROM table_14118521_1 WHERE launch_date = "July 8, 1994" | sql_create_context |
CREATE TABLE table_name_40 (
team_1 VARCHAR
) | What is the 1st leg that has a Rc Cannes Team 1? | SELECT 1 AS st_leg FROM table_name_40 WHERE team_1 = "rc cannes" | sql_create_context |
CREATE TABLE table_14948647_1 (
bhofen_number2__rk_ VARCHAR,
ga_pa__rk_ VARCHAR
) | What was the Bhofen #2 score and rank for the player whose GA-PA score and rank was 227.5 (19)? | SELECT bhofen_number2__rk_ FROM table_14948647_1 WHERE ga_pa__rk_ = "227.5 (19)" | sql_create_context |
CREATE TABLE table_43087 (
"Game" real,
"Date" text,
"Opponent" text,
"Result" text,
"Giants' points" text,
"Opponents' Points" text,
"Record" text,
"TV Time" text,
"Attendance" text
) | How many points did the Giants get when attendance was 78,673? | SELECT "Giants' points" FROM table_43087 WHERE "Attendance" = '78,673' | wikisql |
CREATE TABLE table_203_783 (
id number,
"season" text,
"tier" number,
"division" text,
"place" text
) | how long has internacional de madrid cf been playing in the 3 division ? | SELECT COUNT(*) FROM table_203_783 WHERE "division" = '3a' | squall |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id... | what is diagnoses long title of subject id 94756? | SELECT diagnoses.long_title FROM diagnoses WHERE diagnoses.subject_id = "94756" | mimicsql_data |
CREATE TABLE table_name_47 (
opponent VARCHAR,
record VARCHAR,
game VARCHAR,
february VARCHAR
) | Who was the opponent in games over 58, after Feb 16, and having a record of 40-20-4? | SELECT opponent FROM table_name_47 WHERE game > 58 AND february > 16 AND record = "40-20-4" | sql_create_context |
CREATE TABLE table_train_189 (
"id" int,
"alt" float,
"hyperglycemia" bool,
"liver_disease" bool,
"smoking" bool,
"alcohol_abuse" bool,
"drug_abuse" bool,
"triglyceride_tg" float,
"NOUSE" float
) | active smokers | SELECT * FROM table_train_189 WHERE smoking = 1 | criteria2sql |
CREATE TABLE table_14230 (
"Team" text,
"Tries for" real,
"Tries against" real,
"Try diff" text,
"Points for" real,
"Points against" real,
"Points diff" text
) | Which Tries against has Points against larger than 156, and Points for of 127, and Tries for larger than 17? | SELECT AVG("Tries against") FROM table_14230 WHERE "Points against" > '156' AND "Points for" = '127' AND "Tries for" > '17' | wikisql |
CREATE TABLE table_46040 (
"Rank" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
) | What's the lowest gold with a total over 15 and less than 16 silver? | SELECT MIN("Gold") FROM table_46040 WHERE "Total" > '15' AND "Silver" < '16' | wikisql |
CREATE TABLE train (
Train_ID int,
Name text,
Time text,
Service text
)
CREATE TABLE train_station (
Train_ID int,
Station_ID int
)
CREATE TABLE station (
Station_ID int,
Name text,
Annual_entry_exit real,
Annual_interchanges real,
Total_Passengers real,
Location text,
... | Show the names and total passengers for all train stations not in London. Visualize by bar chart. | SELECT Name, Total_Passengers FROM station WHERE Location <> 'London' | nvbench |
CREATE TABLE event (
ID int,
Name text,
Stadium_ID int,
Year text
)
CREATE TABLE record (
ID int,
Result text,
Swimmer_ID int,
Event_ID int
)
CREATE TABLE stadium (
ID int,
name text,
Capacity int,
City text,
Country text,
Opening_year int
)
CREATE TABLE swimme... | Find meter_200 and the sum of meter_100 , and group by attribute meter_200, and visualize them by a bar chart. | SELECT meter_200, SUM(meter_100) FROM swimmer GROUP BY meter_200 | nvbench |
CREATE TABLE people (
People_ID int,
Name text,
Country text,
Is_Male text,
Age int
)
CREATE TABLE wedding (
Church_ID int,
Male_ID int,
Female_ID int,
Year int
)
CREATE TABLE church (
Church_ID int,
Name text,
Organized_by text,
Open_Date int,
Continuation_of t... | Please compare the number of the church by open date (bin into the weekday) using a bar chart. | SELECT Open_Date, COUNT(Open_Date) FROM church | nvbench |
CREATE TABLE table_name_19 (
branding VARCHAR,
location VARCHAR,
callsign VARCHAR
) | What is the Branding of the Metro Manila Frequency with a Callsign of DWBL? | SELECT branding FROM table_name_19 WHERE location = "metro manila" AND callsign = "dwbl" | sql_create_context |
CREATE TABLE table_55245 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | I want to know the home team score for essendon away team | SELECT "Home team score" FROM table_55245 WHERE "Away team" = 'essendon' | wikisql |
CREATE TABLE table_name_78 (
source VARCHAR,
remainder VARCHAR,
topinka__r_ VARCHAR
) | Which Source has a Remainder of 15%, and a Topinka of 26%? | SELECT source FROM table_name_78 WHERE remainder = "15%" AND topinka__r_ = "26%" | sql_create_context |
CREATE TABLE table_29033869_3 (
round INTEGER,
result__includes_margin_ VARCHAR
) | What is the earliest round where collingswood lost by 36 points? | SELECT MIN(round) FROM table_29033869_3 WHERE result__includes_margin_ = "Lost by 36 points" | sql_create_context |
CREATE TABLE table_name_76 (
entered_service VARCHAR,
gauge VARCHAR,
serial_no VARCHAR
) | What is the date of entered service for the locomotive with a broad gauge and a serial no of 83-1018? | SELECT entered_service FROM table_name_76 WHERE gauge = "broad" AND serial_no = "83-1018" | sql_create_context |
CREATE TABLE table_name_40 (
home_team VARCHAR,
venue VARCHAR
) | What is the home team's score in the game played at glenferrie oval? | SELECT home_team AS score FROM table_name_40 WHERE venue = "glenferrie oval" | sql_create_context |
CREATE TABLE mzjzjlb (
YLJGDM text,
JZLSH text,
KH text,
KLX number,
MJZH text,
HZXM text,
NLS number,
NLY number,
ZSEBZ number,
JZZTDM number,
JZZTMC text,
JZJSSJ time,
TXBZ number,
ZZBZ number,
WDBZ number,
JZKSBM text,
JZKSMC text,
JZKSRQ time,
... | 在门诊诊断为混合性焦虑和抑郁障碍的甲状旁腺素名叫金睿聪的患者的结果定量和单位都是什么? | SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW 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 ... | css |
CREATE TABLE PostTags (
PostId number,
TagId number
)
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE Tags (
Id number,
TagName text,
Count number,
ExcerptPostId number,
WikiPostId number
)
CREATE TABLE SuggestedEdits (
Id number,
... | Tags containing special characters (Stack Overflow). Adapted from answer by hvd (https://stackoverflow.com/a/45380894/3357935) | SELECT * FROM Tags WHERE TagName LIKE '%^-+a-z0-9.%' | sede |
CREATE TABLE table_52175 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Date" text
) | What was the away team when the home team was South Melbourne? | SELECT "Away team" FROM table_52175 WHERE "Home team" = 'south melbourne' | wikisql |
CREATE TABLE table_77490 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Series" text
) | With a 0-2 series, what is the high points? | SELECT "High points" FROM table_77490 WHERE "Series" = '0-2' | wikisql |
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, a bar chart shows the distribution of job_id and department_id , sort from low to high by the JOB_ID. | SELECT JOB_ID, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY JOB_ID | nvbench |
CREATE TABLE university (
school_id number,
school text,
location text,
founded number,
affiliation text,
enrollment number,
nickname text,
primary_conference text
)
CREATE TABLE basketball_match (
team_id number,
school_id number,
team_name text,
acc_regular_season text... | Find the total number of students enrolled in the colleges that were founded after the year of 1850 for each affiliation type. | SELECT SUM(enrollment), affiliation FROM university WHERE founded > 1850 GROUP BY affiliation | spider |
CREATE TABLE table_5590 (
"Game" real,
"Date" text,
"Opponent" text,
"Score" text,
"Location" text,
"Record" text
) | what team scored 17 | SELECT "Date" FROM table_5590 WHERE "Game" = '17' | wikisql |
CREATE TABLE table_17888 (
"No" real,
"Player" text,
"Height" text,
"Position" text,
"Year born" real,
"Current Club" text
) | Which club had a player born in 1983? | SELECT "Current Club" FROM table_17888 WHERE "Year born" = '1983' | wikisql |
CREATE TABLE PostsWithDeleted (
Id number,
PostTypeId number,
AcceptedAnswerId number,
ParentId number,
CreationDate time,
DeletionDate time,
Score number,
ViewCount number,
Body text,
OwnerUserId number,
OwnerDisplayName text,
LastEditorUserId number,
LastEditorDispl... | select count (case when p.PostTypeId=1 then 1 end) from Posts;. | SELECT u.Age, COUNT(CASE WHEN p.PostTypeId = 1 AND p.Score = 0 THEN 1 END) AS equals, COUNT(CASE WHEN p.PostTypeId = 1 AND p.Score > 0 THEN 1 END) AS bolshe FROM Users AS u JOIN Posts AS p ON u.Id = p.OwnerUserId GROUP BY u.Age HAVING COUNT(CASE WHEN p.PostTypeId = 1 THEN 1 END) > 50 | sede |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellv... | what is the name of the medicine that patient 010-40637 was prescribed with within 2 days after having been diagnosed with intracranial injury - with subdural hematoma since 35 months ago? | SELECT t2.drugname FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-40637') AND diagnosis.diagnos... | eicu |
CREATE TABLE device (
Software_Platform VARCHAR
) | List the software platform shared by the greatest number of devices. | SELECT Software_Platform FROM device GROUP BY Software_Platform ORDER BY COUNT(*) DESC LIMIT 1 | sql_create_context |
CREATE TABLE table_75017 (
"Date" text,
"City" text,
"Opponent" text,
"Results\u00b9" text,
"Type of game" text
) | What Type of game was played on Date of July 29? | SELECT "Type of game" FROM table_75017 WHERE "Date" = 'july 29' | wikisql |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE diagnoses (
... | what is the number of patients whose marital status is married and ethnicity is white - russian? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.ethnicity = "WHITE - RUSSIAN" | mimicsql_data |
CREATE TABLE club (
Club_ID int,
Club_name text,
Region text,
Start_year int
)
CREATE TABLE player_coach (
Player_ID int,
Coach_ID int,
Starting_year int
)
CREATE TABLE coach (
Coach_ID int,
Coach_name text,
Gender text,
Club_ID int,
Rank int
)
CREATE TABLE player (
... | Bar chart x axis occupation y axis how many occupation, display in descending by the Y-axis. | SELECT Occupation, COUNT(Occupation) FROM player GROUP BY Occupation ORDER BY COUNT(Occupation) DESC | nvbench |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CRE... | what was the total of patient 002-52932's input until 05/22/2100? | SELECT SUM(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-52932')) AND intakeoutput.cellpath LIKE '%in... | eicu |
CREATE TABLE table_name_4 (
venue VARCHAR,
championships VARCHAR,
established VARCHAR
) | What Venue has more than 1 Championship and was Established after 1957? | SELECT venue FROM table_name_4 WHERE championships = 1 AND established > 1957 | sql_create_context |
CREATE TABLE table_name_57 (
outcome VARCHAR,
tournament VARCHAR
) | Name the outcome with tournament of mexico f12, obreg n | SELECT outcome FROM table_name_57 WHERE tournament = "mexico f12, obregón" | sql_create_context |
CREATE TABLE Transactions_Lots (
transaction_id INTEGER,
lot_id INTEGER
)
CREATE TABLE Sales (
sales_transaction_id INTEGER,
sales_details VARCHAR(255)
)
CREATE TABLE Lots (
lot_id INTEGER,
investor_id INTEGER,
lot_details VARCHAR(255)
)
CREATE TABLE Investors (
investor_id INTEGER,
... | Bin all date of transactions into the YEAR interval, and sum the share count of each bin What is the trend?, and order by the X-axis from high to low please. | SELECT date_of_transaction, SUM(share_count) FROM Transactions ORDER BY date_of_transaction DESC | nvbench |
CREATE TABLE table_22274 (
"Departure" text,
"Going to" text,
"Calling at" text,
"Arrival" text,
"Operator" text
) | how many callings of trains arriving at 09.06 | SELECT COUNT("Calling at") FROM table_22274 WHERE "Arrival" = '09.06' | wikisql |
CREATE TABLE table_name_34 (
soccer VARCHAR,
school VARCHAR
) | Does Detroit have a soccer team? | SELECT soccer FROM table_name_34 WHERE school = "detroit" | sql_create_context |
CREATE TABLE table_202_236 (
id number,
"bank" text,
"foundation" number,
"# of branches\nas of 30 september 2012" number,
"total assets (million tl)\nas of 30 september 2012" number
) | which bank has four times as many assets at taib yatirim bank ? | SELECT "bank" FROM table_202_236 WHERE "total assets (million tl)\nas of 30 september 2012" = (SELECT "total assets (million tl)\nas of 30 september 2012" FROM table_202_236 WHERE "bank" = 'taib yatırım bank') * 4 | squall |
CREATE TABLE table_name_76 (
year_s__won VARCHAR,
to_par VARCHAR
) | What are the years won when the to par is +5? | SELECT year_s__won FROM table_name_76 WHERE to_par = "+5" | sql_create_context |
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... | 列出病人53441764医疗记录中的入院诊断疾病编码和名称,主要针对医疗费总额不低于4790.44元的 | SELECT t_kc24.t_kc21_OUT_DIAG_DIS_CD, t_kc24.t_kc21_OUT_DIAG_DIS_NM FROM t_kc24 WHERE t_kc24.t_kc21_PERSON_ID = '53441764' AND t_kc24.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT >= 4790.44) | css |
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age te... | show me the respiration change in patient 027-136480 second measured on the current icu visit compared to the first value measured on the current icu visit? | SELECT (SELECT vitalperiodic.respiration FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-136480') AND patient.unitdischargetime IS N... | eicu |
CREATE TABLE table_4048 (
"Year" real,
"Host Nation(s)" text,
"Final Venue" text,
"Winner" text,
"Result" text,
"Runner-up" text
) | What are all the winning records when the result is Scotland won on points table and the Runner-Up result is [[|]] 4 points? | SELECT "Winner" FROM table_4048 WHERE "Result" = 'Scotland won on points table' AND "Runner-up" = '[[|]] 4 points' | wikisql |
CREATE TABLE table_2127933_3 (
year VARCHAR,
score VARCHAR
) | How many years had scores of 10 12, 6 1, 6 3? | SELECT COUNT(year) FROM table_2127933_3 WHERE score = "10–12, 6–1, 6–3" | 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 prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
... | what is days of hospital stay of subject name sheila riley? | SELECT demographic.days_stay FROM demographic WHERE demographic.name = "Sheila Riley" | mimicsql_data |
CREATE TABLE table_39179 (
"Date" real,
"Opponent" text,
"Venue" text,
"Result" text,
"Attendance" real,
"Competition" text
) | What kind of competition had an attendance of more than 914 people and the Wightlink Raiders as an opponent? | SELECT "Competition" FROM table_39179 WHERE "Attendance" > '914' AND "Opponent" = 'wightlink raiders' | 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 demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob te... | provide the number of patients whose age is less than 41 and procedure long title is insertion of drug-eluting coronary artery stent(s)? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "41" AND procedures.long_title = "Insertion of drug-eluting coronary artery stent(s)" | mimicsql_data |
CREATE TABLE table_name_57 (
away VARCHAR,
time VARCHAR
) | Who was the away team of the game at the time 15:00? | SELECT away FROM table_name_57 WHERE time = "15:00" | sql_create_context |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.