instruction stringlengths 151 7.46k | output stringlengths 2 4.44k | source stringclasses 26
values |
|---|---|---|
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "13" AND prescriptions.drug = "Tizanidine" | mimicsql_data |
CREATE TABLE table_33722 (
"Year" real,
"Kit Supplier" text,
"Sponsor" text,
"Shirt Printing" text,
"Notes" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What are the notes for the shirt that said Pavv before 2005?
| SELECT "Notes" FROM table_33722 WHERE "Shirt Printing" = 'pavv' AND "Year" < '2005' | wikisql |
CREATE TABLE table_54907 (
"From" text,
"Adult Rate" text,
"Development Rate" text,
"16-17 Year Olds Rate" text,
"Apprentice Rate" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the adult rate when the 16-17 year old rate was 3.40?
| SELECT "Adult Rate" FROM table_54907 WHERE "16-17 Year Olds Rate" = '£3.40' | 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 diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "43" AND diagnoses.short_title = "Prob-head/neck/trunk NOS" | mimicsql_data |
CREATE TABLE table_name_57 (
right_ascension___j2000__ VARCHAR,
constellation VARCHAR,
ngc_number VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the right ascension of Pegasus with a 7343 NGC?
| SELECT right_ascension___j2000__ FROM table_name_57 WHERE constellation = "pegasus" AND ngc_number = "7343" | sql_create_context |
CREATE TABLE table_name_29 (
record VARCHAR,
score VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the record of the game with a score of 101 92?
| SELECT record FROM table_name_29 WHERE score = "101–92" | sql_create_context |
CREATE TABLE party_events (
event_id number,
event_name text,
party_id number,
member_in_charge_id number
)
CREATE TABLE party (
party_id number,
minister text,
took_office text,
left_office text,
region_id number,
party_name text
)
CREATE TABLE region (
region_id number,
... | SELECT COUNT(DISTINCT party_name) FROM party | spider |
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... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Dysthymic disorder" AND lab.fluid = "Ascites" | mimicsql_data |
CREATE TABLE table_name_7 (
goals INTEGER,
nat VARCHAR,
transfer_fee VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the highest goals for youth system and ita
| SELECT MAX(goals) FROM table_name_7 WHERE nat = "ita" AND transfer_fee = "youth system" | sql_create_context |
CREATE TABLE table_name_15 (
course VARCHAR,
type VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which course has km (mi) as a type?
| SELECT course FROM table_name_15 WHERE type = "km (mi)" | sql_create_context |
CREATE TABLE table_name_83 (
site VARCHAR,
attendance VARCHAR,
date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What Site has Attendance of 53,000, and a Date of october 21, 1967?
| SELECT site FROM table_name_83 WHERE attendance = "53,000" AND date = "october 21, 1967" | sql_create_context |
CREATE TABLE table_72678 (
"Player" text,
"G" real,
"Tackles" real,
"Solo" real,
"Assts" real,
"Sacks" text,
"Int" real,
"Int yards" real,
"Int avg." text,
"Int TD" real,
"Fum. rec" real,
"Fum. rec TD" real
)
-- Using valid SQLite, answer the following questions for the... | SELECT MAX("Tackles") FROM table_72678 WHERE "Sacks" = '3.5' | wikisql |
CREATE TABLE Financial_Transactions (
transaction_id INTEGER,
previous_transaction_id INTEGER,
account_id INTEGER,
card_id INTEGER,
transaction_type VARCHAR(15),
transaction_date DATETIME,
transaction_amount DOUBLE,
transaction_comment VARCHAR(255),
other_transaction_details VARCHAR(... | SELECT customer_id, card_number FROM Customers_Cards | nvbench |
CREATE TABLE table_70994 (
"Week" real,
"Date" text,
"Kickoff ( ET )" text,
"Opponent" text,
"Result" text,
"Record" text,
"Game Site" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was the opponent at the Steelers game that had a result... | SELECT "Opponent" FROM table_70994 WHERE "Result" = 'l 20–17' | wikisql |
CREATE TABLE table_name_59 (
date VARCHAR,
opponents_in_the_final VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is Date, when Opponents In The Final, is Maria-Fernanda Alves St phanie Dubois?
| SELECT date FROM table_name_59 WHERE opponents_in_the_final = "maria-fernanda alves stéphanie dubois" | sql_create_context |
CREATE TABLE table_name_92 (
week INTEGER,
result VARCHAR,
attendance VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Week is the highest one that has a Result of w 23-20, and an Attendance smaller than 34,127?
| SELECT MAX(week) FROM table_name_92 WHERE result = "w 23-20" AND attendance < 34 OFFSET 127 | sql_create_context |
CREATE TABLE table_name_79 (
city___state VARCHAR,
event_circuit VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What city is the hidden valley raceway in?
| SELECT city___state FROM table_name_79 WHERE event_circuit = "hidden valley raceway" | sql_create_context |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CRE... | SELECT AVG(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 = '006-171217')) AND intakeoutput.celllabel = 'g tu... | eicu |
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 job_history (
EMPLOYEE_ID decimal(6,0),
START_DATE date,
END_DATE date,
JOB_ID varchar(10),
... | SELECT PHONE_NUMBER, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) | nvbench |
CREATE TABLE table_204_435 (
id number,
"sport" text,
"gold" number,
"silver" number,
"bronze" number,
"total" number
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what sport has more silver medals : wrestling or rowing
| SELECT "sport" FROM table_204_435 WHERE "sport" IN ('wrestling', 'rowing') ORDER BY "silver" DESC LIMIT 1 | squall |
CREATE TABLE table_204_131 (
id number,
"tops design code" text,
"electrical system" text,
"max speed" text,
"weight" text,
"brakes" text,
"route availability" number,
"notes" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- is 08-0av heav... | SELECT (SELECT "weight" FROM table_204_131 WHERE "tops design code" = '08-0av') > (SELECT "weight" FROM table_204_131 WHERE "tops design code" = '08-0lx') | squall |
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 ACC_Road, School_ID FROM basketball_match GROUP BY ACC_Home, ACC_Road ORDER BY ACC_Road DESC | nvbench |
CREATE TABLE table_name_42 (
total_medals VARCHAR,
ensemble VARCHAR,
silver_medals VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the total number of medals received by James Logan High School when it received less than 1 silver medal?
| SELECT COUNT(total_medals) FROM table_name_42 WHERE ensemble = "james logan high school" AND silver_medals < 1 | sql_create_context |
CREATE TABLE table_72581 (
"Cardinal direction" text,
"Burmese" text,
"Sanskrit" text,
"English" text,
"Planet" text,
"Sign" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Burmese term associated with a cardinal direction of west?
| SELECT "Burmese" FROM table_72581 WHERE "Cardinal direction" = 'West' | 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 AVG(zyb.MED_CLINIC_ID) FROM zyb WHERE zyb.MED_SER_ORG_NO = '小儿麻醉科' AND zyb.IN_HOSP_DAYS BETWEEN '2003-05-11' AND '2016-12-20' AND zyb.IN_DIAG_DIS_NM = 'T40.906' | css |
CREATE TABLE table_39269 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Game site" text,
"Attendance" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When is it has 15,557 Attendances?
| SELECT "Date" FROM table_39269 WHERE "Attendance" = '15,557' | 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,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Private" AND diagnoses.icd9_code = "45341" | mimicsql_data |
CREATE TABLE table_name_34 (
city_of_license VARCHAR,
resolution VARCHAR,
official_website VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the city of license with resolution of sd 480i and official website of telemundo.com
| SELECT city_of_license FROM table_name_34 WHERE resolution = "sd 480i" AND official_website = "telemundo.com" | sql_create_context |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id... | SELECT demographic.days_stay, demographic.diagnosis FROM demographic WHERE demographic.subject_id = "8323" | mimicsql_data |
CREATE TABLE table_name_39 (
total INTEGER,
bronze VARCHAR,
gold VARCHAR,
rank VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the average total for teams with more than 1 gold, ranked over 3 and more than 3 bronze?
| SELECT AVG(total) FROM table_name_39 WHERE gold > 1 AND rank > 3 AND bronze > 3 | sql_create_context |
CREATE TABLE table_22707 (
"Period" text,
"Live births per year" text,
"Deaths per year" text,
"Natural change per year" text,
"CBR*" text,
"CDR*" text,
"NC*" text,
"TFR*" text,
"IMR*" real,
"Life expectancy total" text,
"Life expectancy males" text,
"Life expectancy fema... | SELECT "Live births per year" FROM table_22707 WHERE "Life expectancy females" = '73.3' | 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 (
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "M" AND demographic.days_stay > "7" | mimicsql_data |
CREATE TABLE table_name_67 (
draw INTEGER,
performer VARCHAR,
points VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Draw has a Performer of jenny newman, and Points smaller than 77?
| SELECT AVG(draw) FROM table_name_67 WHERE performer = "jenny newman" AND points < 77 | sql_create_context |
CREATE TABLE table_name_75 (
home_team VARCHAR,
away_team VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which team played as the home team when north melbourne played as away?
| SELECT home_team FROM table_name_75 WHERE away_team = "north melbourne" | sql_create_context |
CREATE TABLE table_name_7 (
score VARCHAR,
home VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the score for the game with FK Bratstvo as home team?
| SELECT score FROM table_name_7 WHERE home = "fk bratstvo" | sql_create_context |
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_type text,
admission_location text,
discharge_location text,
insurance text,
language text,
marital_status text,
ethnicity text,
age number
)
CREATE ... | SELECT DISTINCT t1.c1 FROM (SELECT labevents.valuenum, PERCENT_RANK() OVER (ORDER BY labevents.valuenum) AS c1 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'hematocrit') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.ag... | mimic_iii |
CREATE TABLE table_name_61 (
set_2 VARCHAR,
set_1 VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What shows for set 2 when Set 1 is 29 27?
| SELECT set_2 FROM table_name_61 WHERE set_1 = "29–27" | sql_create_context |
CREATE TABLE table_67167 (
"Pick #" text,
"Player" text,
"Position" text,
"Nationality" text,
"NHL team" text,
"College/junior/club team" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What team draft a player from Canada that was picked #43 and... | SELECT "NHL team" FROM table_67167 WHERE "Nationality" = 'canada' AND "Position" = 'right wing' AND "Pick #" = '43' | wikisql |
CREATE TABLE flight (
flno number(4,0),
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0)
)
CREATE TABLE employee (
eid number(9,0),
name varchar2(30),
salary number(10,2)
)
CREATE... | SELECT name, distance FROM aircraft ORDER BY name | nvbench |
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 chartevents ... | SELECT chartevents.charttime 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 = 1249)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial ... | mimic_iii |
CREATE TABLE table_name_39 (
association VARCHAR,
result VARCHAR,
nominee VARCHAR,
year VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the association for Indonesian Idol after 2005 with a Nominated Result?
| SELECT association FROM table_name_39 WHERE nominee = "indonesian idol" AND year > 2005 AND result = "nominated" | sql_create_context |
CREATE TABLE t_kc24 (
MED_SAFE_PAY_ID text,
OVERALL_CD_ORG text,
OVERALL_CD_PERSON text,
MED_CLINIC_ID text,
REF_SLT_FLG number,
CLINIC_SLT_DATE time,
COMP_ID text,
PERSON_ID text,
FLX_MED_ORG_ID text,
INSU_TYPE text,
MED_AMOUT number,
PER_ACC_PAY number,
OVE_PAY numb... | SELECT COUNT(*) FROM (SELECT t_kc21.MED_ORG_DEPT_CD FROM t_kc21 JOIN t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE t_kc21.MED_SER_ORG_NO = '3415980' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2000-08-09' AND '2005-09-08' GROUP BY t_kc21.MED_ORG_DEPT_CD HAVING SUM(t_kc24.MED_AMOUT) < 7321.4) AS T | css |
CREATE TABLE table_74716 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the largest crowd size at a match against the Chicago Cardinals after Week 10 of the season?
| SELECT MAX("Attendance") FROM table_74716 WHERE "Opponent" = 'chicago cardinals' AND "Week" > '10' | wikisql |
CREATE TABLE table_name_51 (
laps INTEGER,
driver VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the highest number of laps for chris amon?
| SELECT MAX(laps) FROM table_name_51 WHERE driver = "chris amon" | sql_create_context |
CREATE TABLE table_name_51 (
total INTEGER,
tour VARCHAR,
giro VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- The sun of total that has a tour of 7 and a Giro smaller than 3 is 12.
| SELECT SUM(total) FROM table_name_51 WHERE tour = 7 AND giro < 3 | sql_create_context |
CREATE TABLE table_41411 (
"Name" text,
"Status" text,
"Authors" text,
"Location" text,
"Notes" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Notes has Authors of zhou clarke zhang?
| SELECT "Notes" FROM table_41411 WHERE "Authors" = 'zhou clarke zhang' | wikisql |
CREATE TABLE advisor (
s_ID varchar(5),
i_ID varchar(5)
)
CREATE TABLE instructor (
ID varchar(5),
name varchar(20),
dept_name varchar(20),
salary numeric(8,2)
)
CREATE TABLE teaches (
ID varchar(5),
course_id varchar(8),
sec_id varchar(8),
semester varchar(6),
year numeric... | SELECT dept_name, budget FROM department WHERE budget > (SELECT AVG(budget) FROM department) ORDER BY budget DESC | nvbench |
CREATE TABLE table_25800134_18 (
series__number INTEGER,
season__number VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- name the most series number for season 22
| SELECT MAX(series__number) FROM table_25800134_18 WHERE season__number = 22 | sql_create_context |
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE cost (
costid number,
uniquepid text,... | SELECT COUNT(*) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-66039')) AND medication.drugname = 'zofran' AND DATETIME(medication.drugst... | eicu |
CREATE TABLE table_name_87 (
opponent VARCHAR,
week VARCHAR,
date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was the opponent for the game taht was before week 5 on October 10, 1954?
| SELECT opponent FROM table_name_87 WHERE week < 5 AND date = "october 10, 1954" | sql_create_context |
CREATE TABLE table_1875157_2 (
starts INTEGER,
winnings VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many starts were there when the winnings are $690,321?
| SELECT MIN(starts) FROM table_1875157_2 WHERE winnings = "$690,321" | sql_create_context |
CREATE TABLE table_41747 (
"Variant id" text,
"5\u2019UTR splice" text,
"Coding" text,
"3\u2019UTR sequence" text,
"GenBank id" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which coding's variant id is abd'1a 3?
| SELECT "Coding" FROM table_41747 WHERE "Variant id" = 'abd''1a 3' | wikisql |
CREATE TABLE has_amenity (
dormid number,
amenid number
)
CREATE TABLE dorm (
dormid number,
dorm_name text,
student_capacity number,
gender text
)
CREATE TABLE lives_in (
stuid number,
dormid number,
room_number number
)
CREATE TABLE student (
stuid number,
lname text,
... | SELECT COUNT(*) FROM student WHERE sex = 'F' AND age < 25 | spider |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.gender = "F" AND prescriptions.formulary_drug_cd = "AZIT500I" | mimicsql_data |
CREATE TABLE table_name_24 (
year INTEGER,
wins INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the lowest year that have wins greater than 0?
| SELECT MIN(year) FROM table_name_24 WHERE wins > 0 | sql_create_context |
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartr... | SELECT patient.hospitaladmitsource FROM patient WHERE patient.uniquepid = '027-4674' AND DATETIME(patient.hospitaladmittime) <= DATETIME(CURRENT_TIME(), '-1 year') ORDER BY patient.hospitaladmittime LIMIT 1 | eicu |
CREATE TABLE table_47400 (
"Position" real,
"Club" text,
"Played" real,
"Points" real,
"Wins" real,
"Draws" real,
"Losses" real,
"Goals for" real,
"Goals against" real,
"Goal Difference" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.... | SELECT COUNT("Goals for") FROM table_47400 WHERE "Draws" = '3' AND "Losses" > '18' AND "Played" < '38' | wikisql |
CREATE TABLE table_36082 (
"Name" text,
"Species Specific" text,
"Intra-molecular structure" text,
"Comparative" text,
"Link" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Name has an Intra-molecular structure of no, and a Link of webserver, ... | SELECT "Name" FROM table_36082 WHERE "Intra-molecular structure" = 'no' AND "Link" = 'webserver' AND "Comparative" = 'no' | wikisql |
CREATE TABLE table_name_18 (
draw INTEGER,
performer VARCHAR,
televotes VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the lowest Draw which has a Performer of kaliopi and a Televotes larger than 3834?
| SELECT MIN(draw) FROM table_name_18 WHERE performer = "kaliopi" AND televotes > 3834 | sql_create_context |
CREATE TABLE table_23812628_1 (
team__number1 VARCHAR,
team__number2 VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the team number 1 for san lorenzo
| SELECT team__number1 FROM table_23812628_1 WHERE team__number2 = "San Lorenzo" | sql_create_context |
CREATE TABLE table_35120 (
"Call sign" text,
"Frequency MHz" real,
"City of license" text,
"ERP W" real,
"Class" text,
"FCC info" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the FCC info for the city of Tribune, Kansas?
| SELECT "FCC info" FROM table_35120 WHERE "City of license" = 'tribune, kansas' | wikisql |
CREATE TABLE table_name_84 (
score VARCHAR,
date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the score from the game played on June 22?
| SELECT score FROM table_name_84 WHERE date = "june 22" | sql_create_context |
CREATE TABLE bridge (
architect_id int,
id int,
name text,
location text,
length_meters real,
length_feet real
)
CREATE TABLE architect (
id text,
name text,
nationality text,
gender text
)
CREATE TABLE mill (
architect_id int,
id int,
location text,
name text,
... | SELECT T1.name, T1.id FROM architect AS T1 JOIN bridge AS T2 ON T1.id = T2.architect_id ORDER BY T1.name | nvbench |
CREATE TABLE table_dev_17 (
"id" int,
"gender" string,
"white_blood_cell_count_wbc" int,
"hemoglobin_a1c_hba1c" float,
"cd4_count" int,
"dyslipidemia" bool,
"renal_disease" bool,
"fasting_blood_glucose_fbg" float,
"creatinine_clearance_cl" float,
"platelet_count" float,
"high... | SELECT * FROM table_dev_17 WHERE fasting_blood_glucose_fbg >= 7 AND hemoglobin_a1c_hba1c >= 7 | criteria2sql |
CREATE TABLE zyjybgb (
BBCJBW text,
BBDM text,
BBMC text,
BBZT number,
BGDH number,
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,
... | SELECT zyjybgb.KSBM, zyjybgb.KSMC FROM zyjybgb WHERE zyjybgb.BGDH = '11178153113' UNION SELECT mzjybgb.KSBM, mzjybgb.KSMC FROM mzjybgb WHERE mzjybgb.BGDH = '11178153113' | css |
CREATE TABLE table_name_53 (
winner VARCHAR,
year VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- who was the winner in 2003?
| SELECT winner FROM table_name_53 WHERE year = "2003" | sql_create_context |
CREATE TABLE table_203_586 (
id number,
"#" number,
"nation" text,
"qualification tournament" text,
"place in qt" number,
"sailor" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- list the nation which participated in the 2008 worlds qualification... | SELECT "nation" FROM table_203_586 WHERE "qualification tournament" = '2008 worlds' AND "sailor" = 'hans spitzauer' | squall |
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_type text,
admission_location text,
... | SELECT SUM(prescriptions.dose_val_rx) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 5887) AND prescriptions.drug = 'levothyroxine sodium' AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 ye... | mimic_iii |
CREATE TABLE table_name_11 (
format VARCHAR,
catalog INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Format has a Catalog smaller than 61298?
| SELECT format FROM table_name_11 WHERE catalog < 61298 | sql_create_context |
CREATE TABLE table_7859 (
"Position" real,
"Club" text,
"Played" real,
"Points" real,
"Wins" real,
"Draws" real,
"Losses" real,
"Goals for" real,
"Goals against" real,
"Goal Difference" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
... | SELECT AVG("Points") FROM table_7859 WHERE "Played" < '30' | wikisql |
CREATE TABLE table_name_32 (
Id VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the value for 2011 corresponding to a 2007 value of 1r?
| SELECT 2011 FROM table_name_32 WHERE 2007 = "1r" | sql_create_context |
CREATE TABLE table_6174 (
"Date" text,
"Tournament" text,
"Location" text,
"Winner" text,
"Score" text,
"1st prize ( $ )" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many 1st prizes have a Date of aug 17?
| SELECT COUNT("1st prize ( $ )") FROM table_6174 WHERE "Date" = 'aug 17' | wikisql |
CREATE TABLE Accounts (
account_id INTEGER,
customer_id INTEGER,
date_account_opened DATETIME,
account_name VARCHAR(50),
other_account_details VARCHAR(255)
)
CREATE TABLE Product_Categories (
production_type_code VARCHAR(15),
product_type_description VARCHAR(80),
vat_rating DECIMAL(19,4... | SELECT T2.customer_first_name, T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id | nvbench |
CREATE TABLE t_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 JOIN t_kc22 JOIN t_kc21_t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc22.MED_CLINIC_ID AND t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID WHERE t_kc21.PERSON_ID = '15314573' AND t_kc22.STA_DATE BETWEEN '2004-04-10' AND '2021-08-16' AND t_kc22.MED_INV_ITEM_TYPE = '西药费' | css |
CREATE TABLE table_52213 (
"Year" real,
"Theme" text,
"Artist" text,
"Mintage" text,
"Issue Price" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the theme of the Year 2002 which was created by Artist Dan Fell?
| SELECT "Theme" FROM table_52213 WHERE "Year" = '2002' AND "Artist" = 'dan fell' | wikisql |
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 txmzjzjlb.YLJGDM FROM hz_info JOIN txmzjzjlb ON hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX WHERE hz_info.RYBH = '72267378' UNION SELECT ftxmzjzjlb.YLJGDM FROM hz_info JOIN ftxmzjzjlb ON hz_info.YLJGDM = ftxmzjzjlb.YLJGDM AND hz_info.KH = ftxmzjzjlb.KH AND hz_i... | css |
CREATE TABLE PostNoticeTypes (
Id number,
ClassId number,
Name text,
Body text,
IsHidden boolean,
Predefined boolean,
PostNoticeDurationId number
)
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
Mark... | SELECT a.Id AS link, q.Title AS title, q.Body AS question, q.OwnerUserId AS asker, q.OwnerDisplayName AS asker_name, a.Body AS answer, q.Tags AS tags, a.Score AS score FROM Posts AS q INNER JOIN Posts AS a ON q.Id = a.ParentId AND a.PostTypeId = 2 AND q.PostTypeId = 1 WHERE a.CommunityOwnedDate IS NULL AND a.OwnerDispl... | sede |
CREATE TABLE flight_leg (
flight_id int,
leg_number int,
leg_flight int
)
CREATE TABLE compartment_class (
compartment varchar,
class_type varchar
)
CREATE TABLE class_of_service (
booking_class varchar,
rank int,
class_description text
)
CREATE TABLE fare (
fare_id int,
from_... | 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, fare_basis AS FARE_BASIS_0, fare_basis AS FARE_BASIS_1, flight, flight_fare WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND F... | atis |
CREATE TABLE t_kc21_t_kc24 (
MED_CLINIC_ID text,
MED_SAFE_PAY_ID number
)
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,
... | SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_ID = '68782989' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT > 4261.3) | css |
CREATE TABLE ship (
Ship_ID int,
Name text,
Type text,
Nationality text,
Tonnage int
)
CREATE TABLE mission (
Mission_ID int,
Ship_ID int,
Code text,
Launched_Year int,
Location text,
Speed_knots int,
Fate text
)
-- Using valid SQLite, answer the following questions fo... | SELECT Type, COUNT(Type) FROM ship GROUP BY Nationality, Type ORDER BY Type DESC | nvbench |
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 intakeoutput (
in... | SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', intakeoutput.intakeoutputtime)) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid =... | eicu |
CREATE TABLE person_info (
CSD text,
CSRQ time,
GJDM text,
GJMC text,
JGDM text,
JGMC text,
MZDM text,
MZMC text,
RYBH text,
XBDM number,
XBMC text,
XLDM text,
XLMC text,
XM text,
ZYLBDM text,
ZYMC text
)
CREATE TABLE zyjzjlb_jybgb (
YLJGDM_ZYJZJLB te... | SELECT AVG(jyjgzbb.JCZBJGDL), MIN(jyjgzbb.JCZBJGDL), MAX(jyjgzbb.JCZBJGDL) FROM mzjzjlb JOIN jybgb JOIN jyjgzbb ON mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE mzjzjlb.JZZDBM = 'G14.222' AND jyjgzbb.JCZBDM = '872554' | css |
CREATE TABLE table_23425 (
"Team" text,
"Province" text,
"Owner(s)" text,
"Price" text,
"Captain" text,
"Head coach" text,
"Icon Player" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- In how many teams is Waqar Younis the head coach?
| SELECT COUNT("Team") FROM table_23425 WHERE "Head coach" = 'Waqar Younis' | wikisql |
CREATE TABLE table_name_48 (
class VARCHAR,
wheel_arrangement VARCHAR,
quantity_made VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the locomotive class that has a wheel arrangement of 2-8-2 and a quantity made of 25?
| SELECT class FROM table_name_48 WHERE wheel_arrangement = "2-8-2" AND quantity_made = "25" | sql_create_context |
CREATE TABLE table_name_5 (
score VARCHAR,
year VARCHAR,
country VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Score, when the Year is after 2007, and when the Country is England?
| SELECT score FROM table_name_5 WHERE year > 2007 AND country = "england" | sql_create_context |
CREATE TABLE table_8723 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Country of the Player with a Score of 75-70-74=219?
| SELECT "Country" FROM table_8723 WHERE "Score" = '75-70-74=219' | wikisql |
CREATE TABLE table_name_48 (
cost___usd__ VARCHAR,
latest_stable_date__version_ VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the cost for latest stable date of online
| SELECT cost___usd__ FROM table_name_48 WHERE latest_stable_date__version_ = "online" | sql_create_context |
CREATE TABLE table_name_70 (
opponent VARCHAR,
score VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the oppenent when the score was 5 0?
| SELECT opponent FROM table_name_70 WHERE score = "5–0" | sql_create_context |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND demographic.admityear < "2150" | mimicsql_data |
CREATE TABLE table_203_358 (
id number,
"pos." number,
"athlete" text,
"run 1" number,
"run 2" number,
"total" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what 's the difference between adam cole 's first run and his second run ?
| SELECT ABS((SELECT "run 1" FROM table_203_358 WHERE "athlete" = 'adam cole') - (SELECT "run 2" FROM table_203_358 WHERE "athlete" = 'adam cole')) | squall |
CREATE TABLE table_12028543_3 (
season VARCHAR,
losingteam VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many seasons was the losing team Adelaide City?
| SELECT COUNT(season) FROM table_12028543_3 WHERE losingteam = "Adelaide City" | sql_create_context |
CREATE TABLE table_name_80 (
venue VARCHAR,
goal INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What venue had less than 2 goals?
| SELECT venue FROM table_name_80 WHERE goal < 2 | sql_create_context |
CREATE TABLE WINE (
Name VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- List the names of all distinct wines in alphabetical order.
| SELECT DISTINCT Name FROM WINE ORDER BY Name | sql_create_context |
CREATE TABLE table_name_22 (
wins INTEGER,
events INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the average number of wins for events larger than 28?
| SELECT AVG(wins) FROM table_name_22 WHERE events > 28 | sql_create_context |
CREATE TABLE table_23944006_4 (
surface VARCHAR,
opponents VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the surface for cara black rennae stubbs
| SELECT surface FROM table_23944006_4 WHERE opponents = "Cara Black Rennae Stubbs" | sql_create_context |
CREATE TABLE table_203_251 (
id number,
"place" text,
"player" text,
"country" text,
"score" text,
"to par" number
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- how many total players played ?
| SELECT COUNT("player") FROM table_203_251 | squall |
CREATE TABLE jybgb (
YLJGDM text,
YLJGDM_MZJZJLB text,
YLJGDM_ZYJZJLB text,
BGDH text,
BGRQ time,
JYLX number,
JZLSH text,
JZLSH_MZJZJLB text,
JZLSH_ZYJZJLB text,
JZLX number,
KSBM text,
KSMC text,
SQRGH text,
SQRXM text,
BGRGH text,
BGRXM text,
SHRGH ... | SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB ... | css |
CREATE TABLE table_2076522_2 (
enrollment__fall_2010_ VARCHAR,
location_s_ VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the enrollment for the school in bottineau?
| SELECT enrollment__fall_2010_ FROM table_2076522_2 WHERE location_s_ = "Bottineau" | sql_create_context |
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
... | SELECT SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t4.diagnosistime) > 5 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.uniquepid, t2.diagnosistime FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid... | eicu |
CREATE TABLE table_name_31 (
score VARCHAR,
date VARCHAR,
away_team VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the score on 23 November 1983 with exeter city as the away team?
| SELECT score FROM table_name_31 WHERE date = "23 november 1983" AND away_team = "exeter city" | sql_create_context |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.