context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
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... | what is the number of patients who underwent allogeneic hematopoietic stem cell transplant without purging and are still alive? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "0" AND procedures.long_title = "Allogeneic hematopoietic stem cell transpant without purging" | mimicsql_data |
CREATE TABLE table_12930 (
"Player" text,
"Country" text,
"Year(s) won" text,
"Total" real,
"To par" real
) | Which To par has a Player of jack nicklaus, and a Total smaller than 146? | SELECT AVG("To par") FROM table_12930 WHERE "Player" = 'jack nicklaus' AND "Total" < '146' | wikisql |
CREATE TABLE Activity (
actid INTEGER,
activity_name varchar(25)
)
CREATE TABLE Faculty (
FacID INTEGER,
Lname VARCHAR(15),
Fname VARCHAR(15),
Rank VARCHAR(15),
Sex VARCHAR(1),
Phone INTEGER,
Room VARCHAR(5),
Building VARCHAR(13)
)
CREATE TABLE Participates_in (
stuid INTEG... | Show the number of male and female assistant professors with a bar chart. | SELECT Sex, COUNT(*) FROM Faculty WHERE Rank = "AsstProf" GROUP BY Sex | nvbench |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE procedures (
... | Give me the number of hispanic/latino-puerto rican patients with unique drug code hydx25. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND prescriptions.formulary_drug_cd = "HYDX25" | mimicsql_data |
CREATE TABLE table_name_5 (
ngc_number INTEGER,
declination___j2000__ VARCHAR,
apparent_magnitude VARCHAR
) | What is the highest NGC number that has a Declination ( J2000 ) of 04 58 and a Apparent magnitude larger than 7.3? | SELECT MAX(ngc_number) FROM table_name_5 WHERE declination___j2000__ = "°04′58″" AND apparent_magnitude > 7.3 | sql_create_context |
CREATE TABLE table_name_38 (
score VARCHAR,
player VARCHAR,
money___£__ VARCHAR,
country VARCHAR
) | Which Score has a Money ( ) of 90,400, and a Country of south africa, and a Player of thomas aiken? Question 1 | SELECT score FROM table_name_38 WHERE money___£__ = "90,400" AND country = "south africa" AND player = "thomas aiken" | sql_create_context |
CREATE TABLE table_48889 (
"Team" text,
"Head coach" text,
"Team captain" text,
"Venue" text,
"Capacity" real,
"Kitmaker" text,
"Shirt sponsor" text,
"Club Chairman" text
) | What is Team, when Capacity is greater than 16,981, and when Venue is 'Atat rk Olympic Stadium'? | SELECT "Team" FROM table_48889 WHERE "Capacity" > '16,981' AND "Venue" = 'atatürk olympic stadium' | wikisql |
CREATE TABLE table_29301050_1 (
train_name VARCHAR,
train_number VARCHAR
) | how many trains have the number 99808 | SELECT COUNT(train_name) FROM table_29301050_1 WHERE train_number = 99808 | sql_create_context |
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 d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
... | count the number of patients diagnosed with diarrhea who did not come to the hospital during the same month since 2105. | SELECT (SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'diarrhea')... | 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
)
... | count the number of patients whose primary disease is st elevated myocardial infarction\cardiac cath and lab test abnormal status is delta? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "ST ELEVATED MYOCARDIAL INFARCTION\CARDIAC CATH" AND lab.flag = "delta" | mimicsql_data |
CREATE TABLE table_74256 (
"Year" real,
"Round" real,
"Winner" text,
"Hawthorn score" text,
"St Kilda score" text,
"Attendance" real,
"Venue" text,
"Silk-Miller Medallist" text
) | How many winners have st kilda score at 14.11.95? | SELECT COUNT("Winner") FROM table_74256 WHERE "St Kilda score" = '14.11.95' | wikisql |
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,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),
FIRST_NAME varcha... | For those employees who do not work in departments with managers that have ids between 100 and 200, find email and salary , and visualize them by a bar chart, and display by the Y-axis from low to high. | SELECT EMAIL, 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 table_75273 (
"Date" text,
"Tournament" text,
"Location" text,
"Winner" text,
"Score" text,
"1st prize ( $ )" real
) | What is the score from the winner Keith Clearwater (1)? | SELECT "Score" FROM table_75273 WHERE "Winner" = 'keith clearwater (1)' | wikisql |
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,... | 患者喻高朗医保的医疗费总额被花了多少,时间是从17年9月7日到21年12月3日 | SELECT SUM(t_kc24.MED_AMOUT) 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 '2017-09-07' AND '2021-12-03' | css |
CREATE TABLE program_course (
program_id int,
course_id int,
workload int,
category varchar
)
CREATE TABLE program (
program_id int,
name varchar,
college varchar,
introduction varchar
)
CREATE TABLE semester (
semester_id int,
semester varchar,
year int
)
CREATE TABLE com... | How many of the prerequisites for ASIANPAM 389 have I met ? | SELECT COUNT(DISTINCT COURSE_1.department, COURSE_0.number) FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite, student_record WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND COURSE_1.course_id = course_prerequisite.course_id AND COURSE_1.department = 'ASIANPAM' AND COURSE_1.number = 389 ... | advising |
CREATE TABLE table_57140 (
"Year" text,
"Security Forces" text,
"Insurgents" text,
"Civilians" text,
"Total:" text
) | Tell me the security forces for 849 total | SELECT "Security Forces" FROM table_57140 WHERE "Total:" = '849' | wikisql |
CREATE TABLE table_name_83 (
score VARCHAR,
date VARCHAR
) | what was the score on june 29? | SELECT score FROM table_name_83 WHERE date = "june 29" | sql_create_context |
CREATE TABLE table_test_2 (
"id" int,
"loss_of_consciousness" bool,
"gender" string,
"bleeding" int,
"systolic_blood_pressure_sbp" int,
"stroke" bool,
"renal_disease" bool,
"hemorrhagic_diathesis" bool,
"transient_ischemic_attack" bool,
"creatinine_clearance_cl" float,
"demen... | uncontrolled arterial hypertension according to investigator decision | SELECT * FROM table_test_2 WHERE hypertension = 1 | criteria2sql |
CREATE TABLE table_17603 (
"#" real,
"Nation" text,
"Winners" real,
"Runners-up" real,
"3rd Place" real,
"4th Place" real
) | what's the runners-up with nation being malaysia | SELECT "Runners-up" FROM table_17603 WHERE "Nation" = 'Malaysia' | wikisql |
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE chartevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE... | so whats the last weight of patient 4718 until 30 months ago? | 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 = 4718)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit wt' ... | mimic_iii |
CREATE TABLE table_name_70 (
took_office INTEGER,
name VARCHAR,
up_for_reelection VARCHAR
) | What was the earliest year that Yvette Alexander took office and was up for reelection after 2016? | SELECT MIN(took_office) FROM table_name_70 WHERE name = "yvette alexander" AND up_for_reelection > 2016 | 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... | 患者在进行78371715301医疗就诊时对应的是哪个门诊号或住院号 | SELECT t_kc21.CLINIC_ID FROM t_kc21 WHERE t_kc21.MED_CLINIC_ID = '78371715301' | css |
CREATE TABLE table_72049 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Attendance" real,
"Record" text
) | Which score has an Opponent of white sox, and a Record of 2-0? | SELECT "Score" FROM table_72049 WHERE "Opponent" = 'white sox' AND "Record" = '2-0' | 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... | 团伙成员95304552药品排序,最常开的是什么? | SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM gwyjzb JOIN t_kc22 ON gwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gwyjzb.PERSON_ID = '95304552' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY COUNT(*) DESC UNION SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM fgwyjzb JOIN t_kc22 ON fgwyjzb.MED_CLIN... | css |
CREATE TABLE table_name_71 (
rank VARCHAR,
fastest_time__s_ VARCHAR,
nation VARCHAR
) | What rank did the United States swimmer come in who posted 11.26 seconds in the 100-meter youth female division? | SELECT COUNT(rank) FROM table_name_71 WHERE fastest_time__s_ = "11.26" AND nation = "united states" | sql_create_context |
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... | when did patient 031-16123 first receive since 98 months ago a blood, venipuncture microbiology test? | SELECT microlab.culturetakentime FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-16123')) AND microlab.culturesite = 'blood, venipuncture' AND... | eicu |
CREATE TABLE table_name_22 (
height_above_sea_level__m_ VARCHAR,
opened VARCHAR,
distance_from_wellington VARCHAR
) | For the station opened after 1876 at 604.53km from Wellington, what is the height above sea level? | SELECT height_above_sea_level__m_ FROM table_name_22 WHERE opened > 1876 AND distance_from_wellington = "604.53km" | sql_create_context |
CREATE TABLE table_name_18 (
status VARCHAR,
total_votes VARCHAR,
couples_team VARCHAR
) | Who had 0 total votes in the purple team? | SELECT status FROM table_name_18 WHERE total_votes = "0" AND couples_team = "purple team" | sql_create_context |
CREATE TABLE table_10082 (
"Institution" text,
"Location" text,
"Team Nickname" text,
"Joined TSCHL" real,
"Home Arena" text,
"Capacity" real,
"Team Website" text
) | what is the team nickname that joined tschl after 2010? | SELECT "Team Nickname" FROM table_10082 WHERE "Joined TSCHL" > '2010' | 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 patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
CREATE TABLE diagnoses_icd (
row_id num... | what are the four most commonly prescribed medications for patients that have been prescribed with nateglinide previously during the same month the last year? | SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'nateglinide' AND DATETIME(prescriptions.startdate, 'start of year... | mimic_iii |
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 prescription... | what is discharge time of subject name dawn cooper? | SELECT demographic.dischtime FROM demographic WHERE demographic.name = "Dawn Cooper" | mimicsql_data |
CREATE TABLE SuggestedEdits (
Id number,
PostId number,
CreationDate time,
ApprovalDate time,
RejectionDate time,
OwnerUserId number,
Comment text,
Text text,
Title text,
Tags text,
RevisionGUID other
)
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal... | Users with the most reputation. | SELECT * FROM (SELECT Id, Reputation FROM Users ORDER BY Reputation DESC LIMIT 50000) AS a ORDER BY Id | sede |
CREATE TABLE table_19145 (
"Season" real,
"Class" text,
"Team" text,
"Motorcycle" text,
"Type" text,
"Races" real,
"Wins" real,
"Podiums" real,
"Poles" real,
"Fastest Laps" real,
"Pts" text,
"Position" text
) | what's the pts with position being nc | SELECT "Pts" FROM table_19145 WHERE "Position" = 'NC' | wikisql |
CREATE TABLE table_name_91 (
player VARCHAR,
score VARCHAR
) | Which Player has a Score of 72-68-78-71=289? | SELECT player FROM table_name_91 WHERE score = 72 - 68 - 78 - 71 = 289 | 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 job_history (
EMPLOYEE_ID decimal(6,0),
START_DATE date,
END_DATE date,
JOB_ID varchar(10),
DEPARTMENT_ID decimal(4,0)
)
CREATE TABLE regions (
REGION_... | 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 hire_date and the average of department_id bin hire_date by weekday, and order in asc by the the average of department id. | SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(DEPARTMENT_ID) | nvbench |
CREATE TABLE table_14117 (
"Title" text,
"Series" text,
"Director" text,
"Production Number" text,
"Release date" text,
"reissue?" text
) | What is the title of the production with a number of 1039? | SELECT "Title" FROM table_14117 WHERE "Production Number" = '1039' | wikisql |
CREATE TABLE table_name_62 (
attendance INTEGER,
date VARCHAR
) | Name the most attendance for 19 february 2005 | SELECT MAX(attendance) FROM table_name_62 WHERE date = "19 february 2005" | sql_create_context |
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE medication (
me... | tell me the cost for the cholecystitis - acute diagnosis? | SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'diagnosis' AND cost.eventid IN (SELECT diagnosis.diagnosisid FROM diagnosis WHERE diagnosis.diagnosisname = 'cholecystitis - acute') | eicu |
CREATE TABLE table_26010857_13 (
general_classification VARCHAR,
stage VARCHAR
) | Who leads the general classification in stage 3? | SELECT general_classification FROM table_26010857_13 WHERE stage = 3 | sql_create_context |
CREATE TABLE table_203_374 (
id number,
"rank" number,
"nation" text,
"gold" number,
"silver" number,
"bronze" number,
"total" number
) | what is russia 's total number of non gold medals ? | SELECT "silver" + "bronze" FROM table_203_374 WHERE "nation" = 'russia' | squall |
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 the number of patients whose year of death is less than or equal to 2179 and diagnoses long title is psychogenic paranoid psychosis? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dod_year <= "2179.0" AND diagnoses.long_title = "Psychogenic paranoid psychosis" | mimicsql_data |
CREATE TABLE table_11824 (
"Player" text,
"Car." real,
"Yards" real,
"Avg." real,
"TD's" real,
"Long" real
) | How many yards for the RB with over 4 carries, 2 TDs, and a long greater than 8? | SELECT COUNT("Yards") FROM table_11824 WHERE "Car." > '4' AND "TD's" = '2' AND "Long" > '8' | wikisql |
CREATE TABLE table_69261 (
"Rank" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
) | What is the highest total medals won by a nation that had 7 bronze but more than 12 silver medals? | SELECT MAX("Total") FROM table_69261 WHERE "Bronze" = '7' AND "Silver" > '12' | wikisql |
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
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),
CO... | For those employees who do not work in departments with managers that have ids between 100 and 200, return a bar chart about the distribution of hire_date and the sum of manager_id bin hire_date by weekday, sort Y-axis in ascending order. | SELECT HIRE_DATE, SUM(MANAGER_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SUM(MANAGER_ID) | nvbench |
CREATE TABLE COURSE (
CRS_CODE varchar(10),
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8)
)
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5)
)
CREATE TABLE DEPARTME... | What is the weekday of birth of professors teaching course ACCT-211? Show a bar chart. | SELECT EMP_DOB, COUNT(EMP_DOB) FROM EMPLOYEE AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM = T2.PROF_NUM WHERE CRS_CODE = "ACCT-211" | nvbench |
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 text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
C... | give me the number of patients whose marital status is divorced and lab test category is hematology? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "DIVORCED" AND lab."CATEGORY" = "Hematology" | mimicsql_data |
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId number,
CreationDate time,
BountyAmount number
)
CREATE TABLE Posts (
Id number,
PostTypeId number,
AcceptedAnswerId number,
ParentId number,
CreationDate time,
DeletionDate time,
Score number,
... | First users to cast close votes on a closed post. Returns the user Id of the first user to cast a close vote on recently closed questions, ordered by closure timestamp. | SELECT PostHistory.PostId AS "post_link", PostHistory.CreationDate AS PostClosureDate, PostHistory.UserId AS "user_link", PostHistory.Comment AS PostClosureComment, CAST(SUBSTRING(PostHistory.Text, STR_POSITION(PostHistory.Text, 'Voters') + 15, STR_POSITION(PostHistory.Text, 'Display') - STR_POSITION(PostHistory.Text, ... | sede |
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... | give me the number of patients whose drug name is nitroglycerin ointment 2%? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "Nitroglycerin Ointment 2%" | mimicsql_data |
CREATE TABLE table_60487 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text
) | What is Country, when Place is 'T8', and when Score is '70-67=137'? | SELECT "Country" FROM table_60487 WHERE "Place" = 't8' AND "Score" = '70-67=137' | wikisql |
CREATE TABLE FlagTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE PostHistoryTypes (
Id number,
Name text
)
CREATE TABLE PostLinks (
Id num... | Where do I comment about 'testfor'. | SELECT PostId AS "post_link", Text FROM Comments WHERE UserId = '##UserId##' AND Text LIKE '%testfor%' | sede |
CREATE TABLE table_60726 (
"County" text,
"Per capita income" text,
"Median household income" text,
"Median family income" text,
"Population" real,
"Number of households" real
) | What is Median Family Income, when Median Household Income is '$50,717'? | SELECT "Median family income" FROM table_60726 WHERE "Median household income" = '$50,717' | wikisql |
CREATE TABLE table_74030 (
"Pick #" real,
"Player" text,
"Position" text,
"Nationality" text,
"NHL team" text,
"College/junior/club team" text
) | what is the position for the nhl team toronto maple leafs? | SELECT "Position" FROM table_74030 WHERE "NHL team" = 'Toronto Maple Leafs' | wikisql |
CREATE TABLE table_60938 (
"Name" text,
"Public" text,
"Intranet" text,
"Extranet" text,
"Personal Sites" text,
"Team Sites" text,
"Developer" text
) | What is the name of the entry that has a developer entry of Yes and a personal sites entry of No? | SELECT "Name" FROM table_60938 WHERE "Developer" = 'yes' AND "Personal Sites" = 'no' | wikisql |
CREATE TABLE table_35143 (
"Position" text,
"Number" real,
"Name" text,
"Height" text,
"Weight" text,
"Class" text,
"Hometown" text,
"Games\u2191" real
) | What is the class for the position of lg? | SELECT "Class" FROM table_35143 WHERE "Position" = 'lg' | wikisql |
CREATE TABLE table_name_71 (
club VARCHAR,
goals VARCHAR
) | What club scored 143 goals? | SELECT club FROM table_name_71 WHERE goals = "143" | sql_create_context |
CREATE TABLE table_name_93 (
restaurant_name VARCHAR,
original_name VARCHAR
) | What is the name of the restaurant originally named Essence? | SELECT restaurant_name FROM table_name_93 WHERE original_name = "essence" | sql_create_context |
CREATE TABLE fielding (
player_id TEXT,
year INTEGER,
stint INTEGER,
team_id TEXT,
league_id TEXT,
pos TEXT,
g INTEGER,
gs NUMERIC,
inn_outs NUMERIC,
po NUMERIC,
a NUMERIC,
e NUMERIC,
dp NUMERIC,
pb NUMERIC,
wp NUMERIC,
sb NUMERIC,
cs NUMERIC,
zr N... | Give me a bar chart that bins the year into day of the week interval, and return the average number of times the team Boston Red Stockings won in the postseasons. | SELECT year, AVG(COUNT(*)) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' | nvbench |
CREATE TABLE table_name_28 (
fa_cup_apps VARCHAR,
league_apps VARCHAR
) | Which FA Cup Apps have League Apps of 21? | SELECT fa_cup_apps FROM table_name_28 WHERE league_apps = "21" | sql_create_context |
CREATE TABLE table_47066 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"Location Attendance" text,
"Record" text
) | What is the average game that has December 17 as the date? | SELECT AVG("Game") FROM table_47066 WHERE "Date" = 'december 17' | wikisql |
CREATE TABLE table_29273182_1 (
directed_by VARCHAR,
production_code VARCHAR
) | Who directed the episode with production code ip03010? | SELECT directed_by FROM table_29273182_1 WHERE production_code = "IP03010" | sql_create_context |
CREATE TABLE table_17113 (
"Player" text,
"Height" text,
"School" text,
"Hometown" text,
"College" text,
"NBA Draft" text
) | Name the total number of nba drafts that went to east side high school | SELECT COUNT("NBA Draft") FROM table_17113 WHERE "School" = 'East Side High School' | wikisql |
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... | tell me the total amount of input that patient 035-3496 had received since 1066 days ago? | 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 = '035-3496')) AND intakeoutput.cellpath LIKE '%int... | eicu |
CREATE TABLE course_tags_count (
course_id int,
clear_grading int,
pop_quiz int,
group_projects int,
inspirational int,
long_lectures int,
extra_credit int,
few_tests int,
good_feedback int,
tough_tests int,
heavy_papers int,
cares_for_students int,
heavy_assignments ... | How many sections of PORTUG 235 are there ? | SELECT COUNT(*) FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'PORTUG' AND course.number = 235 AND semester.semester = 'WN' AND semester.semester_id = course_offering.semester AND semester.year = 2016 | advising |
CREATE TABLE table_name_83 (
directed___undirected VARCHAR,
name VARCHAR,
basis VARCHAR
) | What is the directed/undirected for mfinder, which has a network-centric basis? | SELECT directed___undirected FROM table_name_83 WHERE name = "mfinder" AND basis = "network-centric" | sql_create_context |
CREATE TABLE jobs (
job_id int,
job_title varchar,
description varchar,
requirement varchar,
city varchar,
state varchar,
country varchar,
zip int
)
CREATE TABLE course_prerequisite (
pre_course_id int,
course_id int
)
CREATE TABLE program (
program_id int,
name varchar... | What courses are taught by Prof. Sarah Miller ? | SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND instructor.name LIKE '%Sarah Miller%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = ... | advising |
CREATE TABLE table_train_146 (
"id" int,
"lymphocyte_count" int,
"c_peptide_level" float,
"vitamin_d_deficiency" bool,
"diabetic" string,
"vitamin_d" int,
"NOUSE" float
) | type ii diabetes | SELECT * FROM table_train_146 WHERE diabetic = 'ii' | criteria2sql |
CREATE TABLE table_67020 (
"Rank" text,
"Games" text,
"Player" text,
"Club" text,
"Career span" text
) | What is the number of games for Roger Merrett? | SELECT "Games" FROM table_67020 WHERE "Player" = 'roger merrett' | wikisql |
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 text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
C... | give me the number of patients whose year of birth is less than 2180? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.dob_year < "2180" | mimicsql_data |
CREATE TABLE writes (
paperid int,
authorid int
)
CREATE TABLE journal (
journalid int,
journalname varchar
)
CREATE TABLE paperdataset (
paperid int,
datasetid int
)
CREATE TABLE venue (
venueid int,
venuename varchar
)
CREATE TABLE author (
authorid int,
authorname varchar
... | What is yejin choi 's latest paper ? | SELECT DISTINCT writes.paperid FROM author, paper, writes WHERE author.authorname = 'yejin choi' AND writes.authorid = author.authorid AND writes.paperid = paper.paperid ORDER BY paper.year DESC | scholar |
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE job_history (
EMPLOYEE_ID decimal(6,0),
START_DATE date,
END_DATE date,
JOB_ID varchar(10),
DEPARTMENT_ID decimal(4,0)
)
CREATE TABLE... | 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, a bar chart shows the distribution of hire_date and the average of manager_id bin hire_date by time, list total number from high to low order. | SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY AVG(MANAGER_ID) DESC | nvbench |
CREATE TABLE table_203_276 (
id number,
"album#" text,
"english title" text,
"chinese (traditional)" text,
"chinese (simplified)" text,
"release date" text,
"label" text
) | which album was released later , beautiful , or j' adore ? | SELECT "english title" FROM table_203_276 WHERE "english title" IN ('beautiful', "j'adore") ORDER BY "release date" DESC LIMIT 1 | squall |
CREATE TABLE Customers (
customer_id INTEGER,
customer_type_code VARCHAR(20),
address_line_1 VARCHAR(80),
address_line_2 VARCHAR(80),
town_city VARCHAR(80),
state VARCHAR(80),
email_address VARCHAR(255),
phone_number VARCHAR(80)
)
CREATE TABLE Products (
product_id INTEGER,
pare... | What is the average price of the products for each category, list y axis from low to high order. | SELECT product_category_code, AVG(product_price) FROM Products GROUP BY product_category_code ORDER BY AVG(product_price) | nvbench |
CREATE TABLE zyjzjlb (
YLJGDM text,
JZLSH text,
MZJZLSH text,
KH text,
KLX number,
HZXM text,
WDBZ number,
RYDJSJ time,
RYTJDM number,
RYTJMC text,
JZKSDM text,
JZKSMC text,
RZBQDM text,
RZBQMC text,
RYCWH text,
CYKSDM text,
CYKSMC text,
CYBQDM tex... | 哪些检验类型出现在检验报告单11875806581上? | SELECT JYLX FROM jybgb WHERE BGDH = '11875806581' | css |
CREATE TABLE table_13183076_3 (
_number VARCHAR,
production_code VARCHAR
) | What is the # for the episode with a Production code of 3T7057? | SELECT _number FROM table_13183076_3 WHERE production_code = "3T7057" | sql_create_context |
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | How many patients categorized under a hematology lab test stayed in hospital for more than 4 days? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "4" AND lab."CATEGORY" = "Hematology" | mimicsql_data |
CREATE TABLE table_204_256 (
id number,
"position" number,
"club" text,
"played" number,
"points" number,
"wins" number,
"draws" number,
"losses" number,
"goals for" number,
"goals against" number,
"goal difference" number
) | what club scored the only a total of 79 points ? | SELECT "club" FROM table_204_256 WHERE "points" = 79 | squall |
CREATE TABLE election (
Party VARCHAR,
Party_ID VARCHAR
)
CREATE TABLE party (
Party VARCHAR,
Party_ID VARCHAR
) | What are the names of parties that do not have delegates in election? | SELECT Party FROM party WHERE NOT Party_ID IN (SELECT Party FROM election) | sql_create_context |
CREATE TABLE table_42729 (
"Date" text,
"Tournament" text,
"Winning score" text,
"To par" text,
"Margin of victory" text,
"Runner(s)-up" text
) | What is the Winning score when the To par was 21? | SELECT "Winning score" FROM table_42729 WHERE "To par" = '−21' | wikisql |
CREATE TABLE table_203_763 (
id number,
"year" number,
"competition" text,
"venue" text,
"position" text,
"notes" text
) | how many of the competitions that took place were based in a venue in the united states ? | SELECT COUNT("competition") FROM table_203_763 WHERE "venue" = 'united states' | squall |
CREATE TABLE t_kc21_t_kc22 (
MED_CLINIC_ID text,
MED_EXP_DET_ID number
)
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 ... | 看看医疗就诊55439870587中药品1435开出的医疗发票项目类别填写的是哪一类 | SELECT t_kc22.MED_INV_ITEM_TYPE FROM t_kc22 JOIN t_kc21_t_kc22 JOIN t_kc21 ON t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID AND t_kc21_t_kc22.MED_CLINIC_ID = t_kc21.MED_CLINIC_ID WHERE t_kc21.MED_CLINIC_ID = '55439870587' AND t_kc22.SOC_SRT_DIRE_CD = '1435' | css |
CREATE TABLE table_name_20 (
score VARCHAR,
place VARCHAR,
country VARCHAR
) | Which Score has a Place of t6, and a Country of paraguay? | SELECT score FROM table_name_20 WHERE place = "t6" AND country = "paraguay" | sql_create_context |
CREATE TABLE table_28138035_4 (
mens_singles VARCHAR,
womens_doubles VARCHAR
) | Name the mens singles for lee eun-sil moon hyun-jung | SELECT mens_singles FROM table_28138035_4 WHERE womens_doubles = "Lee Eun-Sil Moon Hyun-Jung" | sql_create_context |
CREATE TABLE table_57531 (
"Country" text,
"Interview" real,
"Swimsuit" real,
"Evening Gown" real,
"Average" real
) | Which is the total number of evening gowns for swimsui less than 9.36 and average less than 9.23? | SELECT COUNT("Evening Gown") FROM table_57531 WHERE "Swimsuit" < '9.36' AND "Average" < '9.23' | wikisql |
CREATE TABLE table_name_82 (
position VARCHAR,
round VARCHAR,
overall VARCHAR
) | What position is the round higher than 15 and has an overall of 411. | SELECT position FROM table_name_82 WHERE round > 15 AND overall = 411 | sql_create_context |
CREATE TABLE program_requirement (
program_id int,
category varchar,
min_credit int,
additional_req varchar
)
CREATE TABLE student (
student_id int,
lastname varchar,
firstname varchar,
program_id int,
declare_major varchar,
total_credit int,
total_gpa float,
entered_as ... | How many sections of AAPTIS 102 are after 10 A.M. ? | SELECT COUNT(*) FROM course, course_offering, semester WHERE course_offering.start_time > '10:00:00' AND course.course_id = course_offering.course_id AND course.department = 'AAPTIS' AND course.number = 102 AND semester.semester = 'WN' AND semester.semester_id = course_offering.semester AND semester.year = 2016 | advising |
CREATE TABLE table_36417 (
"Game" real,
"February" real,
"Opponent" text,
"Score" text,
"Record" text
) | Who was the opponent in games over 58, after Feb 16, and having a record of 40-20-4? | SELECT "Opponent" FROM table_36417 WHERE "Game" > '58' AND "February" > '16' AND "Record" = '40-20-4' | wikisql |
CREATE TABLE table_name_93 (
country VARCHAR,
notes VARCHAR,
release_title VARCHAR
) | Which country had a release of 1 VCD titled Martial Law: Substitutes? | SELECT country FROM table_name_93 WHERE notes = "1 vcd" AND release_title = "martial law: substitutes" | sql_create_context |
CREATE TABLE Office_locations (
building_id int,
company_id int,
move_in_year int
)
CREATE TABLE buildings (
id int,
name text,
City text,
Height int,
Stories int,
Status text
)
CREATE TABLE Companies (
id int,
name text,
Headquarters text,
Industry text,
Sales_... | Return a bar chart showing the number of each company whose office is located in the building, and order in desc by the bar. | SELECT T3.name, COUNT(T3.name) FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id = T2.id JOIN Companies AS T3 ON T1.company_id = T3.id GROUP BY T3.name ORDER BY T3.name DESC | nvbench |
CREATE TABLE table_1341672_10 (
district VARCHAR,
incumbent VARCHAR
) | what is the district where the incumbent is richard kelly? | SELECT district FROM table_1341672_10 WHERE incumbent = "Richard Kelly" | sql_create_context |
CREATE TABLE table_2226817_6 (
no_in_season VARCHAR,
written_by VARCHAR
) | How many season numbers are there for the episodes written by Art Everett? | SELECT COUNT(no_in_season) FROM table_2226817_6 WHERE written_by = "Art Everett" | sql_create_context |
CREATE TABLE table_61288 (
"Name of ground" text,
"Location" text,
"Year" text,
"FC matches" text,
"LA matches" text,
"T20 matches" text,
"Total" text
) | What year had a total of 2 and LA matches of 0? | SELECT "Year" FROM table_61288 WHERE "Total" = '2' AND "LA matches" = '0' | wikisql |
CREATE TABLE table_name_49 (
last_final_lost VARCHAR,
wins VARCHAR
) | When was the last final lost of the club with 7 wins? | SELECT last_final_lost FROM table_name_49 WHERE wins = "7" | sql_create_context |
CREATE TABLE table_204_219 (
id number,
"date" text,
"time" text,
"opponent#" text,
"rank#" text,
"site" text,
"tv" text,
"result" text,
"attendance" number
) | which team has the highest rank among those listed ? | SELECT "opponent#" FROM table_204_219 ORDER BY "rank#" LIMIT 1 | squall |
CREATE TABLE table_name_85 (
points INTEGER,
wins VARCHAR,
year VARCHAR
) | What are the sum of points in 1989 with 0 wins? | SELECT SUM(points) FROM table_name_85 WHERE wins = 0 AND year = 1989 | sql_create_context |
CREATE TABLE table_name_44 (
age_category VARCHAR,
name VARCHAR
) | In which Age Category is Marco Manenti? | SELECT age_category FROM table_name_44 WHERE name = "marco manenti" | sql_create_context |
CREATE TABLE t_kc21_t_kc22 (
MED_CLINIC_ID text,
MED_EXP_DET_ID number
)
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 ... | 统计年龄不低于20岁的患者医疗记录的平均医疗费总共花销是多少? | SELECT AVG(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.MED_CLINIC_ID IN (SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_AGE >= 20) | css |
CREATE TABLE table_29546030_2 (
blank_ends INTEGER,
pf VARCHAR
) | What is the least amount of blank ends for a skip who has 44 PF? | SELECT MIN(blank_ends) FROM table_29546030_2 WHERE pf = 44 | sql_create_context |
CREATE TABLE Allergy_Type (
Allergy VARCHAR(20),
AllergyType VARCHAR(20)
)
CREATE TABLE Has_Allergy (
StuID INTEGER,
Allergy VARCHAR(20)
)
CREATE TABLE Student (
StuID INTEGER,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER... | How many students are affected by each allergy type Visualize by bar chart, could you display total number in descending order please? | SELECT AllergyType, COUNT(*) FROM Has_Allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy GROUP BY T2.AllergyType ORDER BY COUNT(*) DESC | nvbench |
CREATE TABLE flight_stop (
flight_id int,
stop_number int,
stop_days text,
stop_airport text,
arrival_time int,
arrival_airline text,
arrival_flight_number int,
departure_time int,
departure_airline text,
departure_flight_number int,
stop_time int
)
CREATE TABLE class_of_ser... | i need a flight from MONTREAL QUEBEC to SAN DIEGO CALIFORNIA leaving this sunday | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight, state AS STATE_0, state AS STATE_1 WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN DIEGO' AND date_day.day_number = ... | atis |
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... | how many patients admitted before 2111 have been discharged to home health care facility? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "HOME HEALTH CARE" AND demographic.admityear < "2111" | mimicsql_data |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.