context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE Maintenance_Engineers (
engineer_id INTEGER,
company_id INTEGER,
first_name VARCHAR(50),
last_name VARCHAR(50),
other_details VARCHAR(255)
)
CREATE TABLE Third_Party_Companies (
company_id INTEGER,
company_type VARCHAR(5),
company_name VARCHAR(255),
company_address VARC... | which parts have more than 2 faults? Show the part name and id, list Y-axis in ascending order. | SELECT T1.part_name, T1.part_id FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id ORDER BY T1.part_id | nvbench |
CREATE TABLE projects (
code text,
name text,
hours number
)
CREATE TABLE scientists (
ssn number,
name text
)
CREATE TABLE assignedto (
scientist number,
project text
) | What are the names of all the scientists in alphabetical order? | SELECT name FROM scientists ORDER BY name | spider |
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... | Bring me the number of patients less than 70 years who were diagnosed with acute myocardial infarction of inferolateral wall initial episode of care. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "70" AND diagnoses.long_title = "Acute myocardial infarction of inferolateral wall, initial episode of care" | mimicsql_data |
CREATE TABLE table_name_81 (
year INTEGER,
time VARCHAR
) | What is the average year with a 1:42.85 time? | SELECT AVG(year) FROM table_name_81 WHERE time = "1:42.85" | sql_create_context |
CREATE TABLE table_name_67 (
pick__number INTEGER,
overall VARCHAR,
name VARCHAR,
round VARCHAR,
position VARCHAR
) | Which Pick # has a Round larger than 5, and a Position of wide receiver, and a Name of gregory spann, and an Overall larger than 228? | SELECT AVG(pick__number) FROM table_name_67 WHERE round > 5 AND position = "wide receiver" AND name = "gregory spann" AND overall > 228 | sql_create_context |
CREATE TABLE table_name_91 (
losses INTEGER,
wins VARCHAR,
byes VARCHAR
) | What's the total losses when there are 8 wins and less than 2 byes? | SELECT SUM(losses) FROM table_name_91 WHERE wins = 8 AND byes < 2 | sql_create_context |
CREATE TABLE table_name_18 (
round VARCHAR,
position VARCHAR,
college VARCHAR
) | WHAT ROUND HAS A GUARD POSITION AT OHIO COLLEGE? | SELECT round FROM table_name_18 WHERE position = "guard" AND college = "ohio" | sql_create_context |
CREATE TABLE table_61134 (
"Opposing Teams" text,
"Against" real,
"Date" text,
"Venue" text,
"Status" text
) | What is the venue for the match on 30/03/1985? | SELECT "Venue" FROM table_61134 WHERE "Date" = '30/03/1985' | wikisql |
CREATE TABLE table_14603212_5 (
class_aAA VARCHAR,
school_year VARCHAR
) | What are all the AAA classes in the school years of 2004-05? | SELECT class_aAA FROM table_14603212_5 WHERE school_year = "2004-05" | sql_create_context |
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... | 在医疗就诊49142439579中,科室名有美容的科室开了哪些检验报告单?需要这些报告单的编号 | SELECT BGDH FROM jybgb WHERE JZLSH = '49142439579' AND KSMC LIKE '%美容%' | css |
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE medication (
medicatio... | calculate the five year survival rate of the patients diagnosed with hypernatremia - moderate (146 - 155 meq/dl). | SELECT SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t2.diagnosistime) > 5 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOI... | eicu |
CREATE TABLE table_17474 (
"Year" real,
"Division" text,
"League" text,
"Regular Season" text,
"Playoffs" text,
"Open Cup" text
) | What was the result of the playoffs when the regular season was 7th, southeast | SELECT "Playoffs" FROM table_17474 WHERE "Regular Season" = '7th, Southeast' | wikisql |
CREATE TABLE table_55031 (
"Year" real,
"Award" text,
"Category" text,
"Nominee" text,
"Result" text
) | What award was Denis Lawson nominated for in the Best Actor in a Musical category? | SELECT "Award" FROM table_55031 WHERE "Category" = 'best actor in a musical' AND "Nominee" = 'denis lawson' | 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,
... | how many female patients are diagnosed with preterm nec250+g? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "F" AND diagnoses.short_title = "Preterm NEC 2500+g" | mimicsql_data |
CREATE TABLE table_54944 (
"Year" real,
"Artist" text,
"Composition" text,
"Mintage" real,
"Issue Price" text
) | What is the sum of Artist Steve Hepburn's Mintage? | SELECT SUM("Mintage") FROM table_54944 WHERE "Artist" = 'steve hepburn' | wikisql |
CREATE TABLE table_17413485_1 (
first_broadcast VARCHAR,
episode VARCHAR
) | in what date was aired the first broacast of the episode 1x02 | SELECT first_broadcast FROM table_17413485_1 WHERE episode = "1x02" | sql_create_context |
CREATE TABLE table_44695 (
"Solution" text,
"Other Name" text,
"[Na + ](mmol/L)" real,
"[Cl - ](mmol/L)" real,
"[Glucose](mmol/L)" real,
"[Glucose](mg/dl)" real
) | How much is the lowest glucose(mmol/L) with [Na +] under 0? | SELECT MIN("[Glucose](mmol/L)") FROM table_44695 WHERE "[Na + ](mmol/L)" < '0' | wikisql |
CREATE TABLE table_74320 (
"No. in series" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" text,
"U.S. viewers (million)" text
) | Who wrote the episode that got 5.95 million U.S. viewers? | SELECT "Written by" FROM table_74320 WHERE "U.S. viewers (million)" = '5.95' | wikisql |
CREATE TABLE table_name_9 (
club_team VARCHAR,
round VARCHAR,
position VARCHAR
) | What Club team with a Round larger than 5 have a defense position? | SELECT club_team FROM table_name_9 WHERE round > 5 AND position = "defense" | sql_create_context |
CREATE TABLE table_63037 (
"Player" text,
"County" text,
"Tally" text,
"Total" real,
"Matches" real,
"Average" real
) | How many total points did Oisin McConville have from his 5 matches? | SELECT COUNT("Total") FROM table_63037 WHERE "Player" = 'oisin mcconville' AND "Matches" < '5' | wikisql |
CREATE TABLE table_48980 (
"Region" text,
"1950" real,
"1960" real,
"1970" real,
"1980" real,
"1990" real,
"2000" real
) | What is the lowest value for 1990, when the Region is East Asia (10 Economies), and when 1960 has a value less than 12.6? | SELECT MIN("1990") FROM table_48980 WHERE "Region" = 'east asia (10 economies)' AND "1960" < '12.6' | wikisql |
CREATE TABLE table_name_18 (
date VARCHAR,
loss VARCHAR
) | What was the date of the game with a loss of Bush (1 5)? | SELECT date FROM table_name_18 WHERE loss = "bush (1–5)" | sql_create_context |
CREATE TABLE CLASS (
CLASS_CODE varchar(5),
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int
)
CREATE TABLE COURSE (
CRS_CODE varchar(10),
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8)
)
CREATE... | Show the number of courses for each office in a stacked bar chart The x-axis is office name and group by course description, and rank x axis in descending order. | SELECT PROF_OFFICE, COUNT(PROF_OFFICE) FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM JOIN COURSE AS T3 ON T1.CRS_CODE = T3.CRS_CODE JOIN PROFESSOR AS T4 ON T2.EMP_NUM = T4.EMP_NUM GROUP BY CRS_DESCRIPTION, PROF_OFFICE ORDER BY PROF_OFFICE DESC | nvbench |
CREATE TABLE table_79648 (
"Year" real,
"Player" text,
"Country" text,
"Score" text,
"To Par" text,
"Margin" real,
"Earnings ($)" real
) | Which To Par has Earnings ($) larger than 360,000, and a Year larger than 1998, and a Country of united states, and a Score of 69-68-66-64=267? | SELECT "To Par" FROM table_79648 WHERE "Earnings ($)" > '360,000' AND "Year" > '1998' AND "Country" = 'united states' AND "Score" = '69-68-66-64=267' | wikisql |
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
enddate time,
drug text,
dose_val_rx text,
dose_unit_rx text,
route text
)
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE icustays (
row... | tell me the maximum hospital cost if there is a male gen inflam dis nec since 2100? | SELECT MAX(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT diagnoses_icd.hadm_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'male gen inflam dis nec')) AND STRFTIME('%y', cost.chargetime) ... | mimic_iii |
CREATE TABLE table_76304 (
"noun root (meaning)" text,
"case suffix (case)" text,
"postposition" text,
"full word" text,
"English meaning" text
) | What is Case Suffix (Case), when Postposition is '-mde (drops d)'? | SELECT "case suffix (case)" FROM table_76304 WHERE "postposition" = '-mde (drops d)' | 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 was hired before 2002-06-21, visualize a scatter chart about the correlation between salary and commission_pct . | SELECT SALARY, COMMISSION_PCT FROM employees WHERE HIRE_DATE < '2002-06-21' | nvbench |
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospit... | until 2104, what was the yearly minimum weight of patient 005-86645? | SELECT MIN(patient.admissionweight) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-86645') AND NOT patient.admissionweight IS NULL AND STRFTIME('%y', patient.unitadmittime) <= '2104' GROUP BY STRFTIME('%y', patient.unitadmitt... | eicu |
CREATE TABLE table_26967904_2 (
f_bolt VARCHAR,
p1_diameter__mm_ VARCHAR
) | What is the f bolt for 11.35 p1 diameter (mm)? | SELECT f_bolt FROM table_26967904_2 WHERE p1_diameter__mm_ = "11.35" | sql_create_context |
CREATE TABLE table_17926 (
"Position" real,
"Club" text,
"Played" real,
"Won" real,
"Drawn" real,
"Lost" real,
"Pts For" real,
"Pts Agst" real,
"B.P." real,
"Points" real
) | What position did the sheffield eagles finish in? | SELECT MAX("Position") FROM table_17926 WHERE "Club" = 'Sheffield Eagles' | wikisql |
CREATE TABLE manufacturers (
code number,
name text,
headquarter text,
founder text,
revenue number
)
CREATE TABLE products (
code number,
name text,
price number,
manufacturer number
) | What are the names of products with price at most 200? | SELECT name FROM products WHERE price <= 200 | spider |
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... | 统计医院9343283的出院诊断为慢性牙周炎的在医疗记录中最低医疗费总额是多少?最高医疗费总额是多少? | SELECT MIN(t_kc24.MED_AMOUT), MAX(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.t_kc21_MED_SER_ORG_NO = '9343283' AND t_kc24.t_kc21_OUT_DIAG_DIS_NM = '慢性牙周炎') | css |
CREATE TABLE table_18812 (
"Specification" text,
"Gender" text,
"Junior High School (12\u201315 yrs)" text,
"Senior High School (15\u201318 yrs)" text,
"University students and Adults (18yrs+)" text
) | What amount of senior high school where junior high school is 114cm? | SELECT "Senior High School (15\u201318 yrs)" FROM table_18812 WHERE "Junior High School (12\u201315 yrs)" = '114cm' | wikisql |
CREATE TABLE table_67528 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text
) | Who had a score of 69-70=139? | SELECT "Player" FROM table_67528 WHERE "Score" = '69-70=139' | wikisql |
CREATE TABLE table_name_86 (
winners VARCHAR,
runners_up VARCHAR
) | Who was the winner when the runner-up was Chemnitzer FC II? | SELECT winners FROM table_name_86 WHERE runners_up = "chemnitzer fc ii" | sql_create_context |
CREATE TABLE table_5974 (
"Rank" real,
"Rider" text,
"Team" text,
"Speed" text,
"Time" text
) | Team of honda 250cc, and a Time of 31 03.093 has what lowest rank? | SELECT MIN("Rank") FROM table_5974 WHERE "Team" = 'honda 250cc' AND "Time" = '31’ 03.093' | wikisql |
CREATE TABLE table_33071 (
"Lecturers" real,
"Associate professors" real,
"Assistant professors" real,
"Professors" real,
"Total" real
) | What is the total in the case where theere are 6 lecturers and fewer than 48 professors? | SELECT AVG("Total") FROM table_33071 WHERE "Lecturers" = '6' AND "Professors" < '48' | wikisql |
CREATE TABLE food_service (
meal_code text,
meal_number int,
compartment text,
meal_description varchar
)
CREATE TABLE time_interval (
period text,
begin_time int,
end_time int
)
CREATE TABLE flight_stop (
flight_id int,
stop_number int,
stop_days text,
stop_airport text,
... | what ground transportation is available in DENVER | SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'DENVER' AND ground_service.city_code = city.city_code | atis |
CREATE TABLE table_29880 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
) | How many games did they play on january 7? | SELECT COUNT("High points") FROM table_29880 WHERE "Date" = 'January 7' | 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 procedures (
... | what is average age of patients whose language is cape and primary disease is coronary artery disease? | SELECT AVG(demographic.age) FROM demographic WHERE demographic.language = "CAPE" AND demographic.diagnosis = "CORONARY ARTERY DISEASE" | mimicsql_data |
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE admissions (
row_id number,
subject_id number,
... | how much is the change in sodium in patient 17462 second measured on the current hospital visit compared to the first value measured on the current hospital visit? | SELECT (SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 17462 AND admissions.dischtime IS NULL) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'sodium') ORDER BY labevents.charttime L... | mimic_iii |
CREATE TABLE college (
college_id number,
name text,
leader_name text,
college_location text
)
CREATE TABLE member (
member_id number,
name text,
country text,
college_id number
)
CREATE TABLE round (
round_id number,
member_id number,
decoration_theme text,
rank_in_rou... | List the names of members who did not participate in any round. | SELECT name FROM member WHERE NOT member_id IN (SELECT member_id FROM round) | spider |
CREATE TABLE table_name_57 (
score VARCHAR,
home_team VARCHAR
) | What was the final score for the match where Hereford United was the home team? | SELECT score FROM table_name_57 WHERE home_team = "hereford united" | sql_create_context |
CREATE TABLE table_name_6 (
name VARCHAR,
transfer_window VARCHAR,
moving_to VARCHAR
) | What's the name that had a moving to Anorthosis Famagusta and a transfer window of winter? | SELECT name FROM table_name_6 WHERE transfer_window = "winter" AND moving_to = "anorthosis famagusta" | sql_create_context |
CREATE TABLE table_44862 (
"Rank" real,
"Name" text,
"S-League" text,
"Singapore Cup" text,
"Singapore League Cup" text,
"AFC Cup" text,
"Total" text
) | Which AFC cup does Kenji Arai have? | SELECT "AFC Cup" FROM table_44862 WHERE "Name" = 'kenji arai' | 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... | give me the number of patients whose age is less than 80 and drug code is aztr1000fb? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "80" AND prescriptions.formulary_drug_cd = "AZTR1000FB" | mimicsql_data |
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... | count the number of patients whose days of hospital stay is greater than 1 and diagnoses short title is malnutrition mild degree? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "1" AND diagnoses.short_title = "Malnutrition mild degree" | mimicsql_data |
CREATE TABLE table_name_24 (
location VARCHAR,
opponent VARCHAR
) | Where did arturo segovia compete? | SELECT location FROM table_name_24 WHERE opponent = "arturo segovia" | 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 job_history (
EMPLOYEE_ID decimal(6,0),
START_DATE date,
END_DATE date,
JOB_ID... | 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, give me the comparison about the average of department_id over the hire_date bin hire_date by time by a bar chart, I want to rank by the Y-axis in asc. | SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY AVG(DEPARTMENT_ID) | nvbench |
CREATE TABLE table_77539 (
"Rider" text,
"Horse" text,
"Faults" text,
"Round 1 Points" text,
"Total" real
) | Tell me the rider with 18.185 points round 1 | SELECT "Rider" FROM table_77539 WHERE "Round 1 Points" = '18.185' | wikisql |
CREATE TABLE mzb (
CLINIC_ID text,
COMP_ID text,
DATA_ID text,
DIFF_PLACE_FLG number,
FERTILITY_STS number,
FLX_MED_ORG_ID text,
HOSP_LEV number,
HOSP_STS number,
IDENTITY_CARD text,
INPT_AREA_BED text,
INSURED_IDENTITY number,
INSURED_STS text,
INSU_TYPE text,
IN... | 患者何美华在医疗机构5350296的既往病历里检查过多少次,时间是从02年7月14日到14年8月18日 | SELECT COUNT(*) FROM qtb JOIN t_kc22 ON qtb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE qtb.PERSON_NM = '何美华' AND t_kc22.STA_DATE BETWEEN '2002-07-14' AND '2014-08-18' AND qtb.MED_SER_ORG_NO = '5350296' AND t_kc22.MED_INV_ITEM_TYPE = '检查费' UNION SELECT COUNT(*) FROM gyb JOIN t_kc22 ON gyb.MED_CLINIC_ID = t_kc22.MED_CLIN... | css |
CREATE TABLE table_name_49 (
voltage VARCHAR,
model_number VARCHAR
) | What's the voltage for the pentium dual-core e2140? | SELECT voltage FROM table_name_49 WHERE model_number = "pentium dual-core e2140" | sql_create_context |
CREATE TABLE table_name_55 (
result VARCHAR,
week VARCHAR
) | What was the result of the game on week 11? | SELECT result FROM table_name_55 WHERE week = 11 | sql_create_context |
CREATE TABLE table_36958 (
"Outcome" text,
"Date" text,
"Location" text,
"Surface" text,
"Opponent in final" text,
"Score" text
) | Name the date for clay surface and location of santos, brazil | SELECT "Date" FROM table_36958 WHERE "Surface" = 'clay' AND "Location" = 'santos, brazil' | wikisql |
CREATE TABLE table_67901 (
"Tournament" text,
"2006" text,
"2007" text,
"2008" text,
"2009" text,
"2010" text,
"2011" text,
"2012" text
) | What is the 2010 result of a tournament that is A in 2006 and A in 2011? | SELECT "2010" FROM table_67901 WHERE "2011" = 'a' AND "2006" = 'a' | wikisql |
CREATE TABLE table_37942 (
"School" text,
"City" text,
"Team Name" text,
"Enrollment" real,
"IHSAA Class" text,
"IHSAA Football Class" text,
"County" text
) | What school is in Brookville? | SELECT "School" FROM table_37942 WHERE "City" = 'brookville' | wikisql |
CREATE TABLE table_name_64 (
round INTEGER,
pick__number VARCHAR,
position VARCHAR
) | what is the round when the pick # is less than 236 and the position is offensive guard? | SELECT AVG(round) FROM table_name_64 WHERE pick__number < 236 AND position = "offensive guard" | sql_create_context |
CREATE TABLE zyjzjlb (
CYBQDM text,
CYBQMC text,
CYCWH text,
CYKSDM text,
CYKSMC text,
CYSJ time,
CYZTDM number,
HZXM text,
JZKSDM text,
JZKSMC text,
JZLSH text,
KH text,
KLX number,
MZBMLX number,
MZJZLSH text,
MZZDBM text,
MZZDMC text,
MZZYZDZZBM... | 在2003年4月11日到2012年1月23日这段时间医院5023348有多少科室在门诊就诊期间开出的检验报告单比19张多的? | SELECT COUNT(*) FROM (SELECT jybgb.KSBM FROM txmzjzjlb JOIN jybgb ON txmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND txmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE txmzjzjlb.YLJGDM = '5023348' AND jybgb.BGRQ BETWEEN '2003-04-11' AND '2012-01-23' GROUP BY jybgb.KSBM HAVING COUNT(*) >= 19 UNION SELECT jybgb.KSBM FROM ftxmzjzjlb... | css |
CREATE TABLE table_23274514_6 (
date VARCHAR,
record VARCHAR
) | What day was the record 14-27? | SELECT date FROM table_23274514_6 WHERE record = "14-27" | sql_create_context |
CREATE TABLE table_name_81 (
agg VARCHAR,
team_1 VARCHAR
) | What is Team 1 Al-Hilal's Agg.? | SELECT agg FROM table_name_81 WHERE team_1 = "al-hilal" | sql_create_context |
CREATE TABLE table_name_22 (
grid INTEGER,
manufacturer VARCHAR,
time_retired VARCHAR
) | What was the highest grid value for riders with manufacturer of Aprilia and time of +1.660? | SELECT MAX(grid) FROM table_name_22 WHERE manufacturer = "aprilia" AND time_retired = "+1.660" | sql_create_context |
CREATE TABLE customer_orders (
order_id number,
customer_id number,
store_id number,
order_date time,
planned_delivery_date time,
actual_delivery_date time,
other_order_details text
)
CREATE TABLE customers (
customer_id text,
address_id number,
customer_name text,
customer_... | What is the payment method code used by the most orders? | SELECT payment_method_code FROM invoices GROUP BY payment_method_code ORDER BY COUNT(*) DESC LIMIT 1 | spider |
CREATE TABLE table_name_6 (
swim__15km_ VARCHAR,
event VARCHAR,
athlete VARCHAR
) | Daniela Ryf who competes in the women's even had what swim (1.5km)? | SELECT swim__15km_ FROM table_name_6 WHERE event = "women's" AND athlete = "daniela ryf" | sql_create_context |
CREATE TABLE course_prerequisite (
pre_course_id int,
course_id int
)
CREATE TABLE area (
course_id int,
area varchar
)
CREATE TABLE semester (
semester_id int,
semester varchar,
year int
)
CREATE TABLE offering_instructor (
offering_instructor_id int,
offering_id int,
instruc... | Is the ROMLING 450 course available in next semester ? | SELECT COUNT(*) > 0 FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'ROMLING' AND course.number = 450 AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016 | advising |
CREATE TABLE aircraft (
aircraft_code varchar,
aircraft_description varchar,
manufacturer varchar,
basic_type varchar,
engines int,
propulsion varchar,
wide_body varchar,
wing_span int,
length int,
weight int,
capacity int,
pay_load int,
cruising_speed int,
range_... | i would like to go from ATLANTA to DENVER on tuesday | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' AND date_day.day_number = 22 AND date_day.month_number = 3 AND da... | atis |
CREATE TABLE table_64315 (
"Name" text,
"Geographic code" text,
"Type" text,
"Households" real,
"Population (2004)" real,
"Foreign population" real,
"Moroccan population" real
) | Which Population (2004) has a Moroccan population larger than 234506? | SELECT AVG("Population (2004)") FROM table_64315 WHERE "Moroccan population" > '234506' | wikisql |
CREATE TABLE equipment_sequence (
aircraft_code_sequence varchar,
aircraft_code varchar
)
CREATE TABLE state (
state_code text,
state_name text,
country_name text
)
CREATE TABLE days (
days_code varchar,
day_name varchar
)
CREATE TABLE city (
city_code varchar,
city_name varchar,
... | show me the cheapest flights from SAN FRANCISCO to BOSTON | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SAN FRANCISCO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND ... | atis |
CREATE TABLE table_67766 (
"Film" text,
"Director(s)" text,
"Producer(s)" text,
"Recipient" text,
"Date" text,
"Award" text
) | Who directed the film that Avie Luthra received an award for? | SELECT "Director(s)" FROM table_67766 WHERE "Recipient" = 'avie luthra' | wikisql |
CREATE TABLE table_name_27 (
location VARCHAR,
opponent VARCHAR
) | Where was the game against the buffalo sabres? | SELECT location FROM table_name_27 WHERE opponent = "buffalo sabres" | sql_create_context |
CREATE TABLE table_name_91 (
length_fuel VARCHAR,
floor_styling VARCHAR,
year_built VARCHAR
) | What is the Length/Fuel of the bus built between 2000-2003 with a high Floor Styling? | SELECT length_fuel FROM table_name_91 WHERE floor_styling = "high" AND year_built = "2000-2003" | sql_create_context |
CREATE TABLE Participants (
Participant_ID INTEGER,
Participant_Type_Code CHAR(15),
Participant_Details VARCHAR(255)
)
CREATE TABLE Participants_in_Events (
Event_ID INTEGER,
Participant_ID INTEGER
)
CREATE TABLE Services (
Service_ID INTEGER,
Service_Type_Code CHAR(15)
)
CREATE TABLE Eve... | Bar chart x axis event details y axis how many event details, sort Y-axis in desc order. | SELECT Event_Details, COUNT(Event_Details) FROM Events GROUP BY Event_Details ORDER BY COUNT(Event_Details) DESC | nvbench |
CREATE TABLE table_70074 (
"Goal" text,
"Location" text,
"Lineup" text,
"Assist/pass" text,
"Score" text,
"Result" text,
"Competition" text
) | Which Assist/pass has a Score of 1-0, and a Goal of 5? | SELECT "Assist/pass" FROM table_70074 WHERE "Score" = '1-0' AND "Goal" = '5' | wikisql |
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... | 依照科室的不同编码以及入院诊断疾病编码的区别算算医院1120246所有的记录里有民政补助的部分与总的医疗费用之比的最大值并把算出的数值由高到低来排列 | SELECT t_kc21.MED_ORG_DEPT_CD, t_kc21.IN_DIAG_DIS_NM, MAX(t_kc24.CIVIL_SUBSIDY / t_kc24.MED_AMOUT) FROM t_kc21 JOIN t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE t_kc21.MED_SER_ORG_NO = '1120246' GROUP BY t_kc21.MED_ORG_DEPT_CD, t_kc21.IN_DIAG_DIS_NM ORDER BY MAX(t_kc24.CIVIL_SUBSIDY / t_kc24.MED_AMOUT) D... | css |
CREATE TABLE table_74492 (
"Year" text,
"Competition" text,
"Opponent" text,
"Score" text,
"Venue" text
) | At what venue was there a competition with a score reported as 7.14 (56) - 4.5 (29)? | SELECT "Venue" FROM table_74492 WHERE "Score" = '7.14 (56) - 4.5 (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 ethnicity of subject name stephanie suchan? | SELECT demographic.ethnicity FROM demographic WHERE demographic.name = "Stephanie Suchan" | mimicsql_data |
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name text
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
va... | has patient 41014 been admitted to a hospital er the last year? | SELECT COUNT(*) > 0 FROM admissions WHERE admissions.subject_id = 41014 AND admissions.admission_location = 'emergency room admit' AND DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') | mimic_iii |
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 whose days of hospital stay is greater than 15 and lab test name is calcium, urine? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "15" AND lab.label = "Calcium, Urine" | mimicsql_data |
CREATE TABLE table_name_95 (
attendance VARCHAR,
week VARCHAR
) | What is Attendance, when Week is 5? | SELECT attendance FROM table_name_95 WHERE week = 5 | sql_create_context |
CREATE TABLE table_2328113_1 (
percentage__2006_ VARCHAR,
mother_tongue VARCHAR
) | What was the percentage in 2006 whose natives is Polish? | SELECT percentage__2006_ FROM table_2328113_1 WHERE mother_tongue = "Polish" | sql_create_context |
CREATE TABLE table_name_54 (
starts INTEGER,
avg_finish INTEGER
) | How many starts for an average finish greater than 43? | SELECT SUM(starts) FROM table_name_54 WHERE avg_finish > 43 | sql_create_context |
CREATE TABLE table_name_22 (
winner VARCHAR,
prize VARCHAR
) | What Winner had a Prize of z 2,153,999? | SELECT winner FROM table_name_22 WHERE prize = "zł2,153,999" | sql_create_context |
CREATE TABLE table_47082 (
"Game" real,
"Date" text,
"Opponent" text,
"Score" text,
"Record" text
) | Can you tell me the Record that has the Game larger than 15, and the Opponent of edmonton oilers? | SELECT "Record" FROM table_47082 WHERE "Game" > '15' AND "Opponent" = 'edmonton oilers' | wikisql |
CREATE TABLE publication (
abstract varchar,
cid int,
citation_num int,
jid int,
pid int,
reference_num int,
title varchar,
year int
)
CREATE TABLE domain_journal (
did int,
jid int
)
CREATE TABLE journal (
homepage varchar,
jid int,
name varchar
)
CREATE TABLE dom... | return me the number of papers in PVLDB after 2000 in ' University of Michigan ' . | SELECT COUNT(DISTINCT (publication.title)) FROM author, journal, organization, publication, writes WHERE journal.name = 'PVLDB' AND organization.name = 'University of Michigan' AND organization.oid = author.oid AND publication.jid = journal.jid AND publication.year > 2000 AND writes.aid = author.aid AND writes.pid = pu... | academic |
CREATE TABLE manufacturers (
name VARCHAR,
revenue INTEGER,
headquarter VARCHAR
) | Find the name of companies whose revenue is smaller than the revenue of all companies based in Austin. | SELECT name FROM manufacturers WHERE revenue < (SELECT MIN(revenue) FROM manufacturers WHERE headquarter = 'Austin') | sql_create_context |
CREATE TABLE table_47432 (
"Date" text,
"Tournament" text,
"Surface" text,
"Opponent" text,
"Score" text
) | What Tournament's Score was 6 2, 4 6, 6 4? | SELECT "Tournament" FROM table_47432 WHERE "Score" = '6–2, 4–6, 6–4' | wikisql |
CREATE TABLE table_name_10 (
loss INTEGER,
name VARCHAR,
gain VARCHAR
) | What is the lowest Loss with Gain larger than 319 for derrick locke? | SELECT MIN(loss) FROM table_name_10 WHERE name = "derrick locke" AND gain > 319 | sql_create_context |
CREATE TABLE mountain (
mountain_id number,
name text,
height number,
prominence number,
range text,
country text
)
CREATE TABLE climber (
climber_id number,
name text,
country text,
time text,
points number,
mountain_id number
) | What are the countries of mountains with height bigger than 5000? | SELECT country FROM mountain WHERE height > 5000 | spider |
CREATE TABLE table_50489 (
"Position" real,
"Equipment" text,
"Points" real,
"Wins" text,
"Second" text,
"Third" text
) | What is Equipment, when Points is less than 6, and when Position is 53? | SELECT "Equipment" FROM table_50489 WHERE "Points" < '6' AND "Position" = '53' | wikisql |
CREATE TABLE table_76049 (
"Round" text,
"Main date" text,
"Number of fixtures" real,
"Clubs" text,
"New entries this round" text
) | What is the sum of Number of fixtures when the rounds shows quarter-finals? | SELECT SUM("Number of fixtures") FROM table_76049 WHERE "Round" = 'quarter-finals' | wikisql |
CREATE TABLE table_26736 (
"Series No." real,
"Episode No." real,
"Title" text,
"Directed by" text,
"Written by" text,
"UK Ratings (BBC2 Rank)" text,
"Original air date" text
) | Name the written by for john trefor | SELECT "Written by" FROM table_26736 WHERE "Directed by" = 'John Trefor' | wikisql |
CREATE TABLE basketball_match (
Team_ID int,
School_ID int,
Team_Name text,
ACC_Regular_Season text,
ACC_Percent text,
ACC_Home text,
ACC_Road text,
All_Games text,
All_Games_Percent int,
All_Home text,
All_Road text,
All_Neutral text
)
CREATE TABLE university (
Scho... | Draw a bar chart about the distribution of All_Games and School_ID . | SELECT All_Games, School_ID FROM basketball_match | nvbench |
CREATE TABLE instructor (
id text,
name text,
dept_name text,
salary number
)
CREATE TABLE takes (
id text,
course_id text,
sec_id text,
semester text,
year number,
grade text
)
CREATE TABLE course (
course_id text,
title text,
dept_name text,
credits number
)
... | What is the name of the instructor who advises the student with the greatest number of total credits? | SELECT T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id ORDER BY T3.tot_cred DESC LIMIT 1 | spider |
CREATE TABLE table_58004 (
"Singular abbreviation" text,
"Singular Word" text,
"Plural abbreviation" text,
"Plural Word" text,
"Discipline" text
) | A singular abbreviation of p. is used for what singular word? | SELECT "Singular Word" FROM table_58004 WHERE "Singular abbreviation" = 'p.' | wikisql |
CREATE TABLE table_80294 (
"Track" real,
"Recorded" text,
"Catalogue" text,
"Release Date" text,
"Chart Peak" text,
"Song Title" text,
"Writer(s)" text,
"Time" text
) | What is the time of songs that have the writer Aaron Schroeder and Wally Gold? | SELECT "Time" FROM table_80294 WHERE "Writer(s)" = 'aaron schroeder and wally gold' | 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... | count the number of patients whose admission type is emergency and drug route is buccal. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND prescriptions.route = "BUCCAL" | mimicsql_data |
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
DeletionDate time,
ReviewTaskStateId number,
PostId number,
SuggestedEditId number,
CompletedByReviewTaskId number
)
CREATE TABLE Tags (
Id number,
TagName text,
Count number,
ExcerptPostId... | Find questions titles that are not phrased as questions. Find question titles that do not contain the Five Ws (Who, What, When, Where and why), interrogative words, and question marks.
This query MAY be useful for identifying titles that aren't phrased as a question or low quality questions.
Special thanks: s.tk/user... | SELECT Id AS "post_link" FROM Posts WHERE NOT Title LIKE '%Who%' AND NOT Title LIKE '%What%' AND NOT Title LIKE '%When%' AND NOT Title LIKE '%Where%' AND NOT Title LIKE '%Why%' AND NOT Title LIKE '%How%' AND NOT Title LIKE '%Can%' AND NOT Title LIKE '%Is%' AND NOT Title LIKE '%Which%' AND NOT Title LIKE '%Was%' AND NOT... | sede |
CREATE TABLE university (
school VARCHAR,
founded VARCHAR,
affiliation VARCHAR
) | Find the schools that were either founded after 1850 or public. | SELECT school FROM university WHERE founded > 1850 OR affiliation = 'Public' | sql_create_context |
CREATE TABLE table_62448 (
"Elected" text,
"Assembled" text,
"Dissolved" text,
"1st member" text,
"2nd member" text
) | Who was the 2nd member of the parliament that was assembled on 3 november 1529? | SELECT "2nd member" FROM table_62448 WHERE "Assembled" = '3 november 1529' | wikisql |
CREATE TABLE table_name_21 (
pick INTEGER,
name VARCHAR
) | Lowest pick for mike flater? | SELECT MIN(pick) FROM table_name_21 WHERE name = "mike flater" | sql_create_context |
CREATE TABLE Users (
Id number,
Reputation number,
CreationDate time,
DisplayName text,
LastAccessDate time,
WebsiteUrl text,
Location text,
AboutMe text,
Views number,
UpVotes number,
DownVotes number,
ProfileImageUrl text,
EmailHash text,
AccountId number
)
CRE... | Numbers of downvotes on posts by a specific user. | SELECT p.Id AS "post_link", COUNT(v.Id) FROM Votes AS v JOIN Posts AS p ON v.PostId = p.Id WHERE (p.OwnerUserId = '##id?210401##') AND (v.VoteTypeId = 3) GROUP BY p.Id ORDER BY p.Id | sede |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.