instruction stringlengths 151 7.46k | output stringlengths 2 4.44k | source stringclasses 26
values |
|---|---|---|
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PostHistory (
Id number,
PostHistoryTypeId number,
PostId number,
RevisionGUID other,
CreationDate time,
UserId number,
UserDisplayName text,
Comment text,
Text text,
ContentLicense... | SELECT COUNT(Id) FROM Users WHERE LastAccessDate > '2017-07-24 00:00:01' AND Reputation > 150 | sede |
CREATE TABLE student_record (
student_id int,
course_id int,
semester int,
grade varchar,
how varchar,
transfer_source varchar,
earn_credit varchar,
repeat_term varchar,
test_id varchar
)
CREATE TABLE ta (
campus_job_id int,
student_id int,
location varchar
)
CREATE TAB... | SELECT DISTINCT COURSE_1.department, COURSE_1.name, COURSE_1.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND COURSE_0.department = 'ENDODONT' AND COURSE_0.number = 652 AND COURSE_1.course_id = course_prerequisite.course_id | advising |
CREATE TABLE table_27133147_3 (
date_of_vacancy VARCHAR,
manner_of_departure VARCHAR,
position_in_table VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- If the position in table is 10th, and the manner of departure was resigned, what was the date of vacanc... | SELECT date_of_vacancy FROM table_27133147_3 WHERE manner_of_departure = "Resigned" AND position_in_table = "10th" | sql_create_context |
CREATE TABLE table_name_94 (
attendance INTEGER,
result VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the highest attendance at a game with a result of 5-1?
| SELECT MAX(attendance) FROM table_name_94 WHERE result = "5-1" | sql_create_context |
CREATE TABLE table_25186 (
"Romanised name" text,
"Chinese name" text,
"age at appointment" real,
"Portfolio" text,
"Prior occupation" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was Anthony Leung Kam-Chung previous position?
| SELECT "Portfolio" FROM table_25186 WHERE "Romanised name" = 'Anthony Leung Kam-chung' | wikisql |
CREATE TABLE time_interval (
period text,
begin_time int,
end_time int
)
CREATE TABLE restriction (
restriction_code text,
advance_purchase int,
stopovers text,
saturday_stay_required text,
minimum_stay int,
maximum_stay int,
application text,
no_discounts text
)
CREATE TAB... | 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, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRA... | atis |
CREATE TABLE table_27047 (
"No. in series" real,
"No. in season" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who wrote the episode that... | SELECT "Written by" FROM table_27047 WHERE "Original air date" = 'April 29, 1994' | wikisql |
CREATE TABLE table_name_97 (
council VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What's the 2003 result for the falkirk council?
| SELECT 2003 AS _result FROM table_name_97 WHERE council = "falkirk" | sql_create_context |
CREATE TABLE table_name_10 (
goals_conceded INTEGER,
points VARCHAR,
lost VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the total of Goals Conceded that has Points smaller than 21 and a Lost thats smaller than 8?
| SELECT SUM(goals_conceded) FROM table_name_10 WHERE points < 21 AND lost < 8 | 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... | SELECT jyjgzbb.JYZBLSH FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN person_info_hz_info JOIN person_info ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJ... | css |
CREATE TABLE prereq (
course_id varchar(8),
prereq_id varchar(8)
)
CREATE TABLE student (
ID varchar(5),
name varchar(20),
dept_name varchar(20),
tot_cred numeric(3,0)
)
CREATE TABLE course (
course_id varchar(8),
title varchar(50),
dept_name varchar(20),
credits numeric(2,0)
)... | SELECT building, AVG(capacity) FROM classroom GROUP BY building ORDER BY building | nvbench |
CREATE TABLE table_37644 (
"Location (State, City)" text,
"USN 2013" real,
"BW 2013" real,
"Forbes 2011" real,
"Ec 2013" real,
"FT 2011" real,
"AE 2011" real,
"CNN 2011" real,
"BI 2013" real,
"ARWU 2012" real
)
-- Using valid SQLite, answer the following questions for the table... | SELECT AVG("AE 2011") FROM table_37644 WHERE "Forbes 2011" = '24' AND "FT 2011" < '44' | wikisql |
CREATE TABLE table_name_47 (
result VARCHAR,
category VARCHAR,
year VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Result with a Category of album of the year in a Year that is 2011?
| SELECT result FROM table_name_47 WHERE category = "album of the year" AND year = 2011 | sql_create_context |
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wardid number,
admissionheight number,
admissionweight number,
dischargeweight number,
hospitaladmittime time,
... | SELECT COUNT(*) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '035-4428')) AND lab.labname = 'alt (sgpt)' AND DATETIME(lab.labresulttime, 'start of year') ... | eicu |
CREATE TABLE fare_basis (
fare_basis_code text,
booking_class text,
class_type text,
premium text,
economy text,
discounted text,
night text,
season text,
basis_days text
)
CREATE TABLE aircraft (
aircraft_code varchar,
aircraft_description varchar,
manufacturer varchar,... | SELECT DISTINCT fare.fare_id, flight.airline_code, 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 = 'PITTSBURGH' AND CITY_1.city_code = A... | atis |
CREATE TABLE table_43165 (
"Rank" real,
"Name" text,
"S-League" text,
"Singapore Cup" text,
"Singapore League Cup" text,
"Total" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Singapore Cup when the S-League is 5 (14)?
| SELECT "Singapore Cup" FROM table_43165 WHERE "S-League" = '5 (14)' | wikisql |
CREATE TABLE ground_service (
city_code text,
airport_code text,
transport_type text,
ground_fare int
)
CREATE TABLE flight_fare (
flight_id int,
fare_id int
)
CREATE TABLE airport_service (
city_code varchar,
airport_code varchar,
miles_distant int,
direction varchar,
minu... | SELECT DISTINCT FLIGHT_0.arrival_time, FLIGHT_0.departure_time FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, days, flight AS FLIGHT_0, flight AS FLIGHT_1, flight_leg WHERE ((((FLIGHT_1.departure_time <= 2400 AND FLIGHT_1.departure_time >= 1800) AND days... | atis |
CREATE TABLE t_kc21 (
CLINIC_ID text,
CLINIC_TYPE text,
COMP_ID text,
DATA_ID text,
DIFF_PLACE_FLG number,
FERTILITY_STS number,
FLX_MED_ORG_ID text,
HOSP_LEV number,
HOSP_STS number,
IDENTITY_CARD text,
INPT_AREA_BED text,
INSURED_IDENTITY number,
INSURED_STS text,
... | 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 = '85094791445' AND t_kc22.SOC_SRT_DIRE_NM = '阿立哌唑口腔崩解片' | css |
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
... | SELECT COUNT(DISTINCT t2.uniquepid) FROM (SELECT t1.uniquepid, t1.diagnosistime, t1.patienthealthsystemstayid FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = ... | eicu |
CREATE TABLE table_13555999_1 (
gender VARCHAR,
junior_high_school__12_15_yrs_ VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the gender of the junior high school is 24mm?
| SELECT gender FROM table_13555999_1 WHERE junior_high_school__12_15_yrs_ = "24mm" | sql_create_context |
CREATE TABLE table_62352 (
"Name" text,
"Hometown" text,
"Games" text,
"Goals" text,
"Assists" text,
"Points" text,
"Pen. Min." text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many assists did the player with 54 penalty minutes have?
| SELECT "Assists" FROM table_62352 WHERE "Pen. Min." = '54' | wikisql |
CREATE TABLE table_72603 (
"Series #" real,
"Season #" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" text,
"U.S. viewers (million)" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- W... | SELECT MAX("Series #") FROM table_72603 WHERE "U.S. viewers (million)" = '3.84' | wikisql |
CREATE TABLE table_2159571_2 (
successor VARCHAR,
district VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who is every successor for the Washington 3rd District?
| SELECT successor FROM table_2159571_2 WHERE district = "Washington 3rd" | sql_create_context |
CREATE TABLE table_name_49 (
opponent VARCHAR,
week VARCHAR,
result VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was the opponent before week 8 when the result was l 28-17?
| SELECT opponent FROM table_name_49 WHERE week < 8 AND result = "l 28-17" | sql_create_context |
CREATE TABLE table_60701 (
"Season" text,
"League" text,
"Teams" text,
"Home" text,
"Away" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What team has a season of 2009-10?
| SELECT "Teams" FROM table_60701 WHERE "Season" = '2009-10' | wikisql |
CREATE TABLE table_225102_4 (
vacator VARCHAR,
reason_for_change VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the vacator for reason for change died january 12, 1826
| SELECT vacator FROM table_225102_4 WHERE reason_for_change = "Died January 12, 1826" | sql_create_context |
CREATE TABLE table_64099 (
"Tie no" text,
"Home team" text,
"Score" text,
"Away team" text,
"Date" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What home team played against Crystal Palace?
| SELECT "Home team" FROM table_64099 WHERE "Away team" = 'crystal palace' | wikisql |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "80" AND prescriptions.drug = "Oseltamivir" | mimicsql_data |
CREATE TABLE fare_basis (
fare_basis_code text,
booking_class text,
class_type text,
premium text,
economy text,
discounted text,
night text,
season text,
basis_days text
)
CREATE TABLE airline (
airline_code varchar,
airline_name text,
note text
)
CREATE TABLE time_int... | 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, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'OAKLAND... | atis |
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 departments (
DEPARTME... | SELECT CITY, COUNT(CITY) FROM locations GROUP BY CITY ORDER BY CITY | nvbench |
CREATE TABLE table_204_508 (
id number,
"no." number,
"race title" text,
"track" text,
"date" text,
"tv" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what was the name of the first race title ?
| SELECT "race title" FROM table_204_508 ORDER BY "date" LIMIT 1 | squall |
CREATE TABLE employee (
eid number(9,0),
name varchar2(30),
salary number(10,2)
)
CREATE TABLE aircraft (
aid number(9,0),
name varchar2(30),
distance number(6,0)
)
CREATE TABLE flight (
flno number(4,0),
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
... | SELECT destination, COUNT(*) FROM flight GROUP BY destination ORDER BY COUNT(*) DESC | nvbench |
CREATE TABLE table_23715 (
"Year" real,
"District" real,
"Blocks" real,
"Panchayat" real,
"Village" real,
"Human (in Lakh )" text,
"Animal (in Lakh )" text,
"Total Area (in Lakh ha )" text,
"Cropped area (in Lakh ha )" text,
"Crop Damaged (in Lakh INR )" text,
"House Affected... | SELECT COUNT("District") FROM table_23715 WHERE "Crop Damaged (in Lakh INR )" = '1,164.50' | wikisql |
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wardid number,
admissionheight number,
admissionweight number,
dischargeweight number,
hospitaladmittime time,
... | SELECT t1.celllabel FROM (SELECT intakeoutput.celllabel, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM intakeoutput WHERE intakeoutput.cellpath LIKE '%output%' AND STRFTIME('%y', intakeoutput.intakeoutputtime) <= '2100' GROUP BY intakeoutput.celllabel) AS t1 WHERE t1.c1 <= 3 | eicu |
CREATE TABLE table_74075 (
"Salary range" text,
"Indians" text,
"Pakistanis" text,
"Nepalese" text,
"Working force of HK" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- If the Indians are 8.2%, what is the salary range?
| SELECT "Salary range" FROM table_74075 WHERE "Indians" = '8.2%' | wikisql |
CREATE TABLE equipment_sequence (
aircraft_code_sequence varchar,
aircraft_code varchar
)
CREATE TABLE fare (
fare_id int,
from_airport varchar,
to_airport varchar,
fare_basis_code text,
fare_airline text,
restriction_code text,
one_direction_cost int,
round_trip_cost int,
r... | 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, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBU... | atis |
CREATE TABLE table_206217_2 (
epoch__utc_ VARCHAR,
periselene__km_ VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is every entry for epoch if periselene is 2,291.250?
| SELECT epoch__utc_ FROM table_206217_2 WHERE periselene__km_ = "2,291.250" | sql_create_context |
CREATE TABLE table_24425976_2 (
production_code VARCHAR,
season VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many production codes are there for episode 10 in the season?
| SELECT COUNT(production_code) FROM table_24425976_2 WHERE season = "10" | sql_create_context |
CREATE TABLE table_58805 (
"Date" text,
"Opponent#" text,
"Site" text,
"Result" text,
"Attendance" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the result of the game that was attended by 41,650 people?
| SELECT "Result" FROM table_58805 WHERE "Attendance" = '41,650' | 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... | SELECT COUNT(qtb.MED_SER_ORG_NO) FROM qtb WHERE qtb.PERSON_ID = '76533732' AND qtb.IN_HOSP_DATE BETWEEN '2007-06-24' AND '2016-11-03' UNION SELECT COUNT(gyb.MED_SER_ORG_NO) FROM gyb WHERE gyb.PERSON_ID = '76533732' AND gyb.IN_HOSP_DATE BETWEEN '2007-06-24' AND '2016-11-03' UNION SELECT COUNT(zyb.MED_SER_ORG_NO) FROM zy... | css |
CREATE TABLE jobs (
job_id text,
job_title text,
min_salary number,
max_salary number
)
CREATE TABLE employees (
employee_id number,
first_name text,
last_name text,
email text,
phone_number text,
hire_date time,
job_id text,
salary number,
commission_pct number,
... | SELECT first_name, last_name FROM employees WHERE department_id = 70 OR department_id = 90 | spider |
CREATE TABLE bdmzjzjlb (
CYBQDM text,
CYBQMC text,
CYCWH text,
CYKSDM text,
CYKSMC text,
CYSJ time,
CYZTDM number,
HZXM text,
JZKSDM text,
JZKSMC text,
JZLSH number,
KH text,
KLX number,
MZBMLX number,
MZJZLSH text,
MZZDBM text,
MZZDMC text,
MZZYZD... | SELECT wdmzjzjlb.MZBMLX, wdmzjzjlb.MZZDBM, wdmzjzjlb.MZZDMC FROM wdmzjzjlb WHERE wdmzjzjlb.JZLSH = '47241272961' UNION SELECT bdmzjzjlb.MZBMLX, bdmzjzjlb.MZZDBM, bdmzjzjlb.MZZDMC FROM bdmzjzjlb WHERE bdmzjzjlb.JZLSH = '47241272961' | css |
CREATE TABLE table_20557 (
"#" real,
"Date" text,
"at/vs." text,
"Opponent" text,
"Score" text,
"Attendance" real,
"Record" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When was the game played if the attendance is less than 6427.0?
| SELECT "Date" FROM table_20557 WHERE "Attendance" < '6427.0' | wikisql |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE diagnosis (
diagnosisid number... | SELECT t3.culturesite FROM (SELECT t2.culturesite, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'paracentesis' AND DATETIME(treatment.treatme... | eicu |
CREATE TABLE table_name_79 (
nation VARCHAR,
rank VARCHAR,
total VARCHAR,
bronze VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What nation had a medal total of less than 10, less than 1 bronze medal, in rank 11?
| SELECT nation FROM table_name_79 WHERE total < 10 AND bronze < 1 AND rank = "11" | 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... | SELECT jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM person_info JOIN hz_info JOIN wdmzjzjlb JOIN jybgb JOIN jyjgzbb 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_MZ... | css |
CREATE TABLE table_45339 (
"Year" real,
"Domestic freight" real,
"Domestic mail" real,
"International freight" real,
"International mail" real,
"Total freight and mail" real,
"Change" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is th... | SELECT MIN("International mail") FROM table_45339 WHERE "Domestic freight" < '72' AND "Domestic mail" = '0' AND "Year" < '2012' AND "Total freight and mail" > '4,695' | wikisql |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE demographic ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND procedures.long_title = "Endoscopic sphincterotomy and papillotomy" | mimicsql_data |
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 dual_carrier... | SELECT DISTINCT flight.departure_time FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SA... | atis |
CREATE TABLE table_11655 (
"Series #" real,
"Season #" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who wrote series number 99?
| SELECT "Written by" FROM table_11655 WHERE "Series #" = '99' | 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... | SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_ID = '33250252' AND NOT t_kc22.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT >= 3095.33) | css |
CREATE TABLE table_60522 (
"Pick #" real,
"Player" text,
"Nationality" text,
"Position" text,
"NHL team" text,
"Team from" text,
"League from" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which NHL team chose an American player from the Un... | SELECT "NHL team" FROM table_60522 WHERE "Nationality" = 'united states' AND "League from" = 'united states hockey league' | wikisql |
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name text
)
CREATE TABLE icustays (
row_id number,
... | SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t3.itemid FROM (SELECT t2.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.i... | mimic_iii |
CREATE TABLE table_name_76 (
lead VARCHAR,
country VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was Canada's lead?
| SELECT lead FROM table_name_76 WHERE country = "canada" | sql_create_context |
CREATE TABLE comment_instructor (
instructor_id int,
student_id int,
score int,
comment_text varchar
)
CREATE TABLE course_prerequisite (
pre_course_id int,
course_id int
)
CREATE TABLE jobs (
job_id int,
job_title varchar,
description varchar,
requirement varchar,
city var... | SELECT COUNT(*) FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.number = 154 AND instructor.name LIKE '%Kristin Vaneyk%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offe... | advising |
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... | SELECT AVG(demographic.age) FROM demographic WHERE demographic.gender = "M" AND demographic.admission_type = "URGENT" | mimicsql_data |
CREATE TABLE table_name_28 (
score VARCHAR,
opponent VARCHAR,
date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the score of the Devil Rays on April 24?
| SELECT score FROM table_name_28 WHERE opponent = "devil rays" AND date = "april 24" | sql_create_context |
CREATE TABLE t_kc24 (
ACCOUNT_DASH_DATE time,
ACCOUNT_DASH_FLG number,
CASH_PAY number,
CIVIL_SUBSIDY number,
CKC102 number,
CLINIC_ID text,
CLINIC_SLT_DATE time,
COMP_ID text,
COM_ACC_PAY number,
COM_PAY number,
DATA_ID text,
ENT_ACC_PAY number,
ENT_PAY number,
F... | SELECT COUNT(*) FROM t_kc21 WHERE t_kc21.PERSON_NM = '杨艳芳' AND t_kc21.IN_HOSP_DATE BETWEEN '2017-04-12' AND '2018-08-25' AND t_kc21.CLINIC_TYPE = '住院' | css |
CREATE TABLE table_dev_15 (
"id" int,
"hemoglobin_a1c_hba1c" float,
"hepatic_enzymes" bool,
"platelet_count" float,
"liver_disease" bool,
"hba1c" float,
"triglyceride_tg" float,
"NOUSE" float
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- hba... | SELECT * FROM table_dev_15 WHERE hba1c >= 7.5 AND hemoglobin_a1c_hba1c <= 10.5 | criteria2sql |
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 diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
C... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2123" AND lab."CATEGORY" = "Blood Gas" | mimicsql_data |
CREATE TABLE university (
School_ID int,
School text,
Location text,
Founded real,
Affiliation text,
Enrollment real,
Nickname text,
Primary_conference text
)
CREATE TABLE basketball_match (
Team_ID int,
School_ID int,
Team_Name text,
ACC_Regular_Season text,
ACC_Per... | SELECT Team_Name, Team_ID FROM basketball_match | nvbench |
CREATE TABLE table_3865 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name th... | SELECT "Date" FROM table_3865 WHERE "Team" = 'Washington' | wikisql |
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,
city_code VARCHAR(3)
)
CREATE TABLE Allergy_Type (
Allergy VARCHAR(20),
... | SELECT Fname, COUNT(Fname) FROM Student WHERE Sex = 'F' GROUP BY Fname | nvbench |
CREATE TABLE voting_record (
stuid number,
registration_date text,
election_cycle text,
president_vote number,
vice_president_vote number,
secretary_vote number,
treasurer_vote number,
class_president_vote number,
class_senator_vote number
)
CREATE TABLE student (
stuid number,
... | SELECT DISTINCT T1.lname FROM student AS T1 JOIN voting_record AS T2 ON T1.stuid = president_vote EXCEPT SELECT DISTINCT lname FROM student WHERE advisor = "2192" | spider |
CREATE TABLE table_name_81 (
name VARCHAR,
assumed_office VARCHAR,
district VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the name of the Senator in the O District who assumed office in 2013?
| SELECT name FROM table_name_81 WHERE assumed_office = 2013 AND district = "o" | sql_create_context |
CREATE TABLE table_name_83 (
spouse VARCHAR,
name VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the spouse for louise of hesse-kassel
| SELECT spouse FROM table_name_83 WHERE name = "louise of hesse-kassel" | sql_create_context |
CREATE TABLE table_16881 (
"No. in series" text,
"No. in season" text,
"Title" text,
"Directed by" text,
"Written by" text,
"Featured character(s)" text,
"Original air date" text,
"U.S. viewers (million)" text
)
-- Using valid SQLite, answer the following questions for the tables provi... | SELECT "No. in season" FROM table_16881 WHERE "No. in series" = '111' | wikisql |
CREATE TABLE table_name_18 (
date VARCHAR,
opponent VARCHAR,
result VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the date of the game against the Lizards with a result of w 18-17?
| SELECT date FROM table_name_18 WHERE opponent = "lizards" AND result = "w 18-17" | sql_create_context |
CREATE TABLE table_32395 (
"Player" text,
"Team" text,
"Date" text,
"Opposition" text,
"Game" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- On which date did Ger Loughnane from Team Clare have a match?
| SELECT "Date" FROM table_32395 WHERE "Team" = 'clare' AND "Player" = 'ger loughnane' | wikisql |
CREATE TABLE table_18142 (
"District" text,
"Incumbent" text,
"Party" text,
"First elected" real,
"Results" text,
"Candidates" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What party does Bill McCollum belong to?
| SELECT "Party" FROM table_18142 WHERE "Incumbent" = 'Bill McCollum' | wikisql |
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 jybgb_jyjgzbb (
JYZBLSH number,
... | SELECT jybgb.SHRGH, jybgb.SHRXM FROM jybgb WHERE jybgb.JZLSH = '93390516653' GROUP BY jybgb.SHRGH HAVING COUNT(*) > 21 | css |
CREATE TABLE table_name_60 (
number_range VARCHAR,
quantity VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the number range for the 56 quantity?
| SELECT number_range FROM table_name_60 WHERE quantity = "56" | sql_create_context |
CREATE TABLE table_14954150_1 (
result VARCHAR,
date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the result of the game on October 6, 1974?
| SELECT result FROM table_14954150_1 WHERE date = "October 6, 1974" | sql_create_context |
CREATE TABLE table_62252 (
"Place" text,
"Player" text,
"Country" text,
"Score" real,
"To par" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is Tom Kite's Place?
| SELECT "Place" FROM table_62252 WHERE "Player" = 'tom kite' | wikisql |
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 flight_fare ... | 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, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ATLANTA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALTIM... | atis |
CREATE TABLE table_39280 (
"Dance" text,
"Best dancer(s)" text,
"Best score" text,
"Worst dancer(s)" text,
"Worst score" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the best score of the dance freestyle?
| SELECT "Best score" FROM table_39280 WHERE "Dance" = 'freestyle' | wikisql |
CREATE TABLE table_name_96 (
official_itv1_rating VARCHAR,
episode VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Official ITV1 rating for auditions 4?
| SELECT official_itv1_rating FROM table_name_96 WHERE episode = "auditions 4" | sql_create_context |
CREATE TABLE table_name_73 (
Id VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the 2004 value if the 1998 value is 35?
| SELECT 2004 FROM table_name_73 WHERE 1998 = "35" | sql_create_context |
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name text
)
CREATE TABLE outputevents... | SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, COUNT(*) AS c1 FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'loc exc bone lesion n... | mimic_iii |
CREATE TABLE table_59 (
"Crop (kilotonnes)" text,
"New South Wales" real,
"Victoria" real,
"Queensland" real,
"Western Australia" real,
"South Australia" real,
"Tasmania" real,
"Total" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what'... | SELECT MIN("Total") FROM table_59 WHERE "Crop (kilotonnes)" = 's Lupin' | wikisql |
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 allergy (
allergy... | SELECT COUNT(*) > 0 FROM patient WHERE patient.uniquepid = '006-195316' AND patient.hospitaladmitsource = 'emergency department' AND patient.hospitaldischargetime IS NULL | eicu |
CREATE TABLE date_day (
month_number int,
day_number int,
year int,
day_name varchar
)
CREATE TABLE dual_carrier (
main_airline varchar,
low_flight_number int,
high_flight_number int,
dual_airline varchar,
service_name text
)
CREATE TABLE fare (
fare_id int,
from_airport va... | 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 (((flight.departure_time BETWEEN 1200 AND 1800) AND date_day.day_number = 21 AND date_day.month_number = 2 AND date_day.year = 1991 AND days.day_... | atis |
CREATE TABLE table_name_27 (
margin VARCHAR,
date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Margin, when Date is 19 July 2008 (Round 19)?
| SELECT margin FROM table_name_27 WHERE date = "19 july 2008 (round 19)" | sql_create_context |
CREATE TABLE table_14480 (
"Player" text,
"Country" text,
"Year(s) won" text,
"Total" real,
"To par" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What years won when the To par is more than 13?
| SELECT "Year(s) won" FROM table_14480 WHERE "To par" > '13' | 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 diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
C... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "WIDOWED" AND demographic.age < "89" | mimicsql_data |
CREATE TABLE table_203_121 (
id number,
"name" text,
"pos." text,
"caps" number,
"goals" number,
"club" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- how many people have no goals ?
| SELECT COUNT("name") FROM table_203_121 WHERE "goals" = 0 | squall |
CREATE TABLE t_kc21_t_kc24 (
MED_CLINIC_ID text,
MED_SAFE_PAY_ID number
)
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,
... | SELECT t_kc21.IN_DIAG_DIS_CD, t_kc21.IN_DIAG_DIS_NM FROM t_kc21 WHERE t_kc21.PERSON_ID = '91530632' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc21_t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT > 4446.07) | css |
CREATE TABLE table_8912 (
"Round" real,
"Pick" real,
"Overall" real,
"Name" text,
"Position" text,
"College" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which College has a Round of 11, and a Position of wr?
| SELECT "College" FROM table_8912 WHERE "Round" = '11' AND "Position" = 'wr' | wikisql |
CREATE TABLE table_15693 (
"Date" text,
"Score" text,
"Location" text,
"Competition" text,
"Serial No." text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- The competition located in Northampton had a resulting score of what?
| SELECT "Score" FROM table_15693 WHERE "Location" = 'northampton' | wikisql |
CREATE TABLE table_name_96 (
tamil_name VARCHAR,
english_name VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Tamil Name of the Thaipusam holiday?
| SELECT tamil_name FROM table_name_96 WHERE english_name = "thaipusam" | sql_create_context |
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code tex... | SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'treatment' AND cost.eventid IN (SELECT treatment.treatmentid FROM treatment WHERE treatment.treatmentname = 'hypertonic saline administration') | eicu |
CREATE TABLE table_1015521_2 (
us_air_force_equivalent VARCHAR,
commonwealth_equivalent VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- If you are a pilot officer in the commonwealth then what will you called as in the US air force?
| SELECT us_air_force_equivalent FROM table_1015521_2 WHERE commonwealth_equivalent = "Pilot Officer" | sql_create_context |
CREATE TABLE table_name_17 (
gold INTEGER,
silver VARCHAR,
bronze VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the highest Gold that has a Silver less than 7 and Bronze less than 0
| SELECT MAX(gold) FROM table_name_17 WHERE silver < 7 AND bronze < 0 | sql_create_context |
CREATE TABLE table_name_76 (
venue VARCHAR,
home_team VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the venue when the home team was Fitzroy?
| SELECT venue FROM table_name_76 WHERE home_team = "fitzroy" | sql_create_context |
CREATE TABLE table_2923917_4 (
melbourne VARCHAR,
distance VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many listings under Melbourne has a distance at 15km?
| SELECT COUNT(melbourne) FROM table_2923917_4 WHERE distance = "15km" | sql_create_context |
CREATE TABLE table_name_32 (
winning_song VARCHAR,
debut_album VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which winning song had a debut album in progress?
| SELECT winning_song FROM table_name_32 WHERE debut_album = "in progress" | 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 patient (
uniquep... | SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '027-3046' AND patient.hospitalid <> (SELECT DISTINCT patient.hospitalid FROM patient WHERE patient.uniquepid = '027-3046' AND patient.hospitaldischargetime IS NULL)) AND trea... | eicu |
CREATE TABLE table_43636 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Week number with a Result of W 30-28?
| SELECT AVG("Week") FROM table_43636 WHERE "Result" = 'w 30-28' | wikisql |
CREATE TABLE table_name_13 (
candidate VARCHAR,
riding VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who is the Candidate when the Riding is Hochelaga?
| SELECT candidate FROM table_name_13 WHERE riding = "hochelaga" | sql_create_context |
CREATE TABLE table_26565936_2 (
no_in_series VARCHAR,
written_by VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What number(s) in the series was written by bo crese?
| SELECT no_in_series FROM table_26565936_2 WHERE written_by = "Bo Crese" | sql_create_context |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.