instruction stringlengths 151 7.46k | output stringlengths 2 4.44k | source stringclasses 26
values |
|---|---|---|
CREATE TABLE table_62968 (
"play" text,
"author" text,
"company" text,
"base" text,
"country" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Author's Company is Ruth Kanner Theatre Group?
| SELECT "author" FROM table_62968 WHERE "company" = 'ruth kanner theatre group' | wikisql |
CREATE TABLE table_53592 (
"Rank" real,
"Name" text,
"Nation" text,
"Placings" real,
"Figures" real,
"Free" real,
"Total" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the average figure score of the skater with a free score under ... | SELECT AVG("Figures") FROM table_53592 WHERE "Free" < '56.35' | wikisql |
CREATE TABLE jyjgzbb (
JYZBLSH text,
YLJGDM text,
BGDH text,
BGRQ time,
JYRQ time,
JCRGH text,
JCRXM text,
SHRGH text,
SHRXM text,
JCXMMC text,
JCZBDM text,
JCFF text,
JCZBMC text,
JCZBJGDX text,
JCZBJGDL number,
JCZBJGDW text,
SBBM text,
YQBH text... | SELECT mzjzjlb.JZLSH FROM person_info JOIN hz_info JOIN mzjzjlb 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 WHERE person_info.XM = '鲁俊健' AND hz_info.YLJGDM = '5241360' AND mzjzjlb.JZKSMC LIKE '%肾内%' | css |
CREATE TABLE Employees (
Employee_ID INTEGER,
Role_Code CHAR(15),
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1),
Date_of_Birth DATETIME,
Other_Details VARCHAR(255)
)
CREATE TABLE Document_Locations (
Document_ID INTEGER,
Location_Code CHAR(15),
Date_in_Location_From DATETIME,
D... | SELECT Date_Stored, COUNT(Date_Stored) FROM All_Documents AS T1 JOIN Ref_Calendar AS T2 ON T1.Date_Stored = T2.Calendar_Date ORDER BY Date_Stored | nvbench |
CREATE TABLE table_56344 (
"Grand Prix" text,
"Date" text,
"Location" text,
"Pole Position" text,
"Fastest Lap" text,
"Winning Driver" text,
"Constructor" text,
"Report" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which winning driver... | SELECT "Winning Driver" FROM table_56344 WHERE "Location" = 'imola' | wikisql |
CREATE TABLE table_58789 (
"Game" real,
"Date" text,
"Opponent" text,
"Result" text,
"Raiders points" real,
"Opponents" real,
"Raiders first downs" real,
"Record" text,
"Attendance" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What... | SELECT COUNT("Raiders first downs") FROM table_58789 WHERE "Date" = 'nov. 2' AND "Raiders points" > '42' | wikisql |
CREATE TABLE table_54754 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Away team has an Away team score of 13.22 ... | SELECT "Away team" FROM table_54754 WHERE "Away team score" = '13.22 (100)' | wikisql |
CREATE TABLE table_20236726_2 (
builder VARCHAR,
serial_no VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the builder for serial number being 377
| SELECT builder FROM table_20236726_2 WHERE serial_no = 377 | sql_create_context |
CREATE TABLE climber (
Climber_ID int,
Name text,
Country text,
Time text,
Points real,
Mountain_ID int
)
CREATE TABLE mountain (
Mountain_ID int,
Name text,
Height real,
Prominence real,
Range text,
Country text
)
-- Using valid SQLite, answer the following questions ... | SELECT Country, COUNT(Country) FROM mountain WHERE Height > 5000 GROUP BY Country ORDER BY Country DESC | nvbench |
CREATE TABLE table_203_206 (
id number,
"rank" number,
"nation" text,
"gold" number,
"silver" number,
"bronze" number,
"total" number
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what country won the most medals ?
| SELECT "nation" FROM table_203_206 ORDER BY "total" DESC LIMIT 1 | squall |
CREATE TABLE table_62877 (
"Team" text,
"Matches" real,
"Wins" real,
"Wins %" text,
"Draws" real,
"Draws %" text,
"Losses" real,
"Losses %" text,
"Against" real,
"For & Against Ratio" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-... | SELECT SUM("Losses") FROM table_62877 WHERE "Matches" = '2' AND "Against" = '2' AND "Draws %" = '0%' AND "Wins" < '1' | wikisql |
CREATE TABLE table_204_4 (
id number,
"date" text,
"race" text,
"competition" text,
"rider" text,
"country" text,
"location" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- who won the giro d'italia race after wouter weylandt ?
| SELECT "rider" FROM table_204_4 WHERE "race" = "giro d'italia" AND "date" > (SELECT "date" FROM table_204_4 WHERE "rider" = 'wouter weylandt' AND "race" = "giro d'italia") ORDER BY "date" LIMIT 1 | squall |
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... | SELECT AVG(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.MED_CLINIC_ID IN (SELECT qtb.MED_CLINIC_ID FROM qtb WHERE qtb.PERSON_AGE >= 22 UNION SELECT gyb.MED_CLINIC_ID FROM gyb WHERE gyb.PERSON_AGE >= 22 UNION SELECT zyb.MED_CLINIC_ID FROM zyb WHERE zyb.PERSON_AGE >= 22 UNION SELECT mzb.MED_CLINIC_ID FROM mzb WHERE mzb.PER... | css |
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE intakeoutput (
i... | SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-58884')) AND DATETIME(lab.labresulttime, 'start of month') = DATETIME(CURRENT_T... | eicu |
CREATE TABLE table_name_56 (
population VARCHAR,
official_name VARCHAR,
area_km_2 VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When the communities name is Balmoral and the area is over 43.51 kilometers squared, what's the total population amount?
| SELECT COUNT(population) FROM table_name_56 WHERE official_name = "balmoral" AND area_km_2 > 43.51 | sql_create_context |
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 (
... | 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.long_title = "Obesity, unspecified" AND lab."CATEGORY" = "Hematology" | mimicsql_data |
CREATE TABLE table_20940 (
"Number" real,
"Name" text,
"Kilometer" real,
"Pavement" text,
"Length (m)" real,
"Average climb (%)" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many have a length of 375?
| SELECT COUNT("Average climb (%)") FROM table_20940 WHERE "Length (m)" = '375' | wikisql |
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
)
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
)
-- Using valid SQLite, answer the following questions for the... | SELECT T1.Name, T1.Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Name | nvbench |
CREATE TABLE table_68153 (
"Race" text,
"Dist (f)" real,
"Course" text,
"Class" text,
"Prize (\u00a3K)" real,
"Odds" text,
"Runners" real,
"Placing" real,
"Margin" real,
"Time" text,
"Jockey" text,
"Trainer" text
)
-- Using valid SQLite, answer the following questions f... | SELECT "Course" FROM table_68153 WHERE "Jockey" = 'fergal lynch' AND "Odds" = '5/1' | wikisql |
CREATE TABLE table_name_59 (
score VARCHAR,
tie_no VARCHAR,
home_team VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the score when the tie number was a replay and the home team was mansfield town?
| SELECT score FROM table_name_59 WHERE tie_no = "replay" AND home_team = "mansfield town" | sql_create_context |
CREATE TABLE wedding (
Church_ID int,
Male_ID int,
Female_ID int,
Year int
)
CREATE TABLE church (
Church_ID int,
Name text,
Organized_by text,
Open_Date int,
Continuation_of text
)
CREATE TABLE people (
People_ID int,
Name text,
Country text,
Is_Male text,
Age ... | SELECT Country, COUNT(*) FROM people GROUP BY Country ORDER BY Country | nvbench |
CREATE TABLE hz_info (
KH text,
KLX number,
YLJGDM text,
RYBH text
)
CREATE TABLE person_info (
RYBH text,
XBDM number,
XBMC text,
XM text,
CSRQ time,
CSD text,
MZDM text,
MZMC text,
GJDM text,
GJMC text,
JGDM text,
JGMC text,
XLDM text,
XLMC text... | (SELECT * FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb 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.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE hz_info.RYBH = ... | css |
CREATE TABLE hz_info (
KH text,
KLX number,
RYBH text,
YLJGDM text
)
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,... | SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM hz_info JOIN mzjzjlb JOIN jyjgzbb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jyjgzbb.jybgb_YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jyjgzbb.jybgb_JZLSH_MZJZJLB WHERE mzjzjlb.JZZDBM = 'N63.585' AND hz_info.RYB... | css |
CREATE TABLE Lots (
lot_id INTEGER,
investor_id INTEGER,
lot_details VARCHAR(255)
)
CREATE TABLE Ref_Transaction_Types (
transaction_type_code VARCHAR(10),
transaction_type_description VARCHAR(80)
)
CREATE TABLE Transactions_Lots (
transaction_id INTEGER,
lot_id INTEGER
)
CREATE TABLE Tra... | SELECT investor_id, AVG(share_count) FROM Transactions GROUP BY investor_id | nvbench |
CREATE TABLE table_25572068_1 (
series VARCHAR,
winning_team VARCHAR,
date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- In what series was TDS Racing the winning team on 9 October?
| SELECT series FROM table_25572068_1 WHERE winning_team = "TDS Racing" AND date = "9 October" | sql_create_context |
CREATE TABLE table_52106 (
"Superlative" text,
"Director" text,
"Record Set" text,
"Year" text,
"Notes" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What Superlative had a record set of 12 nominations?
| SELECT "Superlative" FROM table_52106 WHERE "Record Set" = '12 nominations' | wikisql |
CREATE TABLE table_41767 (
"Season" text,
"Series" text,
"Team Name" text,
"Races" real,
"Poles" real,
"Wins" real,
"Points" text,
"Final Placing" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- In the 2005 season, how many races did the ... | SELECT AVG("Races") FROM table_41767 WHERE "Final Placing" = '15th' AND "Season" = '2005' | wikisql |
CREATE TABLE table_74138 (
"Game" real,
"November" real,
"Opponent" text,
"Score" text,
"Location/Attendance" text,
"Record" text,
"Points" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what is the record that had a score of 5-3?
| SELECT "Record" FROM table_74138 WHERE "Score" = '5-3' | wikisql |
CREATE TABLE Rooms (
RoomId TEXT,
roomName TEXT,
beds INTEGER,
bedType TEXT,
maxOccupancy INTEGER,
basePrice INTEGER,
decor TEXT
)
CREATE TABLE Reservations (
Code INTEGER,
Room TEXT,
CheckIn TEXT,
CheckOut TEXT,
Rate REAL,
LastName TEXT,
FirstName TEXT,
Adul... | SELECT decor, COUNT(*) FROM Rooms WHERE bedType = "King" GROUP BY decor ORDER BY decor DESC | nvbench |
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name text
)
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
... | SELECT prescriptions.dose_val_rx FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 52456 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) AND prescriptions.drug = 'promethazine hcl' ORDER BY prescriptions.startdate DESC ... | mimic_iii |
CREATE TABLE table_14036 (
"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 is the date when the away team is bolton wanderers?
| SELECT "Date" FROM table_14036 WHERE "Away team" = 'bolton wanderers' | wikisql |
CREATE TABLE hz_info (
KH text,
KLX number,
RYBH text,
YLJGDM text
)
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,
... | SELECT COUNT(*) FROM mzjzjlb WHERE mzjzjlb.ZZYSGH = '21408957' AND mzjzjlb.JZKSRQ BETWEEN '2004-07-08' AND '2004-11-20' | css |
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... | SELECT ACC_Road, COUNT(ACC_Road) FROM basketball_match GROUP BY ACC_Road | nvbench |
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 INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Myopia" AND lab.fluid = "Ascites" | mimicsql_data |
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Chronic diastolic heart failure" AND prescriptions.route = "DWELL" | mimicsql_data |
CREATE TABLE table_dev_18 (
"id" int,
"bleeding" int,
"chronic_anticoagulant_therapy" bool,
"renal_disease" bool,
"hyperlipidemia" bool,
"creatinine_clearance_cl" float,
"chronic_hemostasis_disorders" bool,
"significant_proteinuria" bool,
"platelet_count" float,
"total_cholestero... | SELECT * FROM table_dev_18 WHERE renal_transplantation = 1 AND (serum_creatinine <= 1.6 AND creatinine_clearance_cl >= 60 AND albumin_excretion <= 300) | criteria2sql |
CREATE TABLE table_name_70 (
spacecraft VARCHAR,
end_time VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the spacecraft with end time of 4 September 04:51?
| SELECT spacecraft FROM table_name_70 WHERE end_time = "4 september 04:51" | sql_create_context |
CREATE TABLE Customers (
customer_id INTEGER,
customer_details VARCHAR(255)
)
CREATE TABLE Residents (
resident_id INTEGER,
property_id INTEGER,
date_moved_in DATETIME,
date_moved_out DATETIME,
other_details VARCHAR(255)
)
CREATE TABLE Things (
thing_id INTEGER,
organization_id INT... | SELECT date_moved_in, COUNT(date_moved_in) FROM Residents ORDER BY COUNT(date_moved_in) DESC | nvbench |
CREATE TABLE semester (
semester_id int,
semester varchar,
year int
)
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE ta (
campus_job_id int,
student_id int,
location varchar
)
CREATE TABLE comment_instructor (
instructor_id int,
student_id int,
sc... | SELECT DISTINCT advisory_requirement, enforced_requirement, name FROM course WHERE department = 'EECS' AND number = 499 | advising |
CREATE TABLE table_name_73 (
year_set VARCHAR,
event VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What year had a 100m freestyle event?
| SELECT COUNT(year_set) FROM table_name_73 WHERE event = "100m freestyle" | sql_create_context |
CREATE TABLE table_name_99 (
score VARCHAR,
time VARCHAR,
venue VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the Score which has a Time of 18:00 and a Venue of african union?
| SELECT score FROM table_name_99 WHERE time = "18:00" AND venue = "african union" | sql_create_context |
CREATE TABLE table_name_21 (
country VARCHAR,
package_option VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which country has a qualsiasi tranne sky hd package/option?
| SELECT country FROM table_name_21 WHERE package_option = "qualsiasi tranne sky hd" | sql_create_context |
CREATE TABLE table_name_16 (
year INTEGER,
us_cham_rank INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Year is the lowest one that has a US Cham Rank smaller than 1?
| SELECT MIN(year) FROM table_name_16 WHERE us_cham_rank < 1 | sql_create_context |
CREATE TABLE table_2190919_1 (
poles VARCHAR,
team_s_ VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What are the poles is #08 Miller racing?
| SELECT poles FROM table_2190919_1 WHERE team_s_ = "#08 Miller Racing" | sql_create_context |
CREATE TABLE table_41348 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Leading scorer" text,
"Record" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What date was Leo Mainoldi (24) the leading scorer?
| SELECT "Date" FROM table_41348 WHERE "Leading scorer" = 'leo mainoldi (24)' | wikisql |
CREATE TABLE table_4241 (
"Train number" real,
"Train name" text,
"Origin" text,
"Destination" text,
"Service" text,
"Route/Via." text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many route/via's are there for the ernad express?
| SELECT COUNT("Route/Via.") FROM table_4241 WHERE "Train name" = 'Ernad Express' | wikisql |
CREATE TABLE table_name_43 (
bulletins_to_all_contacts VARCHAR,
creator VARCHAR,
transport_layer_security VARCHAR,
license VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Were there Bulletins to all contacts of the proprietary license created by Micro... | SELECT bulletins_to_all_contacts FROM table_name_43 WHERE transport_layer_security = "no" AND license = "proprietary" AND creator = "microsoft" | sql_create_context |
CREATE TABLE building (
building_id text,
Name text,
Street_address text,
Years_as_tallest text,
Height_feet int,
Floors int
)
CREATE TABLE protein (
common_name text,
protein_name text,
divergence_from_human_lineage real,
accession_number text,
sequence_length real,
seq... | SELECT Type, COUNT(*) FROM Institution GROUP BY Type ORDER BY Type | nvbench |
CREATE TABLE table_25764073_3 (
title VARCHAR,
season__number VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the title for season number 35
| SELECT title FROM table_25764073_3 WHERE season__number = 35 | sql_create_context |
CREATE TABLE table_46925 (
"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 had an away team of Aston Villa?
| SELECT "Home team" FROM table_46925 WHERE "Away team" = 'aston villa' | wikisql |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime t... | SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'social work consult' AND DATETIME(treatment.treatmenttime) <= DATETIME(CURRENT_TIME(), '-4 year')) AS t1 JOI... | eicu |
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... | SELECT qtb.MED_CLINIC_ID FROM qtb WHERE qtb.PERSON_ID = '39665457' AND qtb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT > 7246.13) UNION SELECT gyb.MED_CLINIC_ID FROM gyb WHERE gyb.PERSON_ID = '39665457' AND gyb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOU... | css |
CREATE TABLE table_name_64 (
title VARCHAR,
released VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What CD was released in 2009?
| SELECT title FROM table_name_64 WHERE released = 2009 | sql_create_context |
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
VoteTypeId number,
CreationDate time
)
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDate time,
RejectionReasonId number,
Comment text
)
CREA... | SELECT d, SUM(h2) OVER (ORDER BY d) AS h2, SUM(hsqldb) OVER (ORDER BY d) AS hsqldb, SUM(derby) OVER (ORDER BY d) AS derby, SUM(mysql) OVER (ORDER BY d) AS mysql, SUM(pgsql) OVER (ORDER BY d) AS pgsql FROM (SELECT DATE(CreationDate) AS d, COUNT(CASE WHEN Tags LIKE '%<h2>%' THEN 1 END) AS h2, COUNT(CASE WHEN Tags LIKE '%... | sede |
CREATE TABLE table_3549 (
"Rank" real,
"Couple" text,
"Judges" real,
"Public" real,
"Total" real,
"Vote percentage" text,
"Result" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was the couple on the bottom two?
| SELECT "Couple" FROM table_3549 WHERE "Result" = 'Bottom two' | wikisql |
CREATE TABLE table_8559 (
"Episode Number" real,
"Air Date" text,
"Event 1" text,
"Event 2" text,
"Event 3" text,
"Event 4" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What episode had sumo ball for event 3 and the wall for event 4?
| SELECT AVG("Episode Number") FROM table_8559 WHERE "Event 4" = 'the wall' AND "Event 3" = 'sumo ball' | wikisql |
CREATE TABLE table_name_24 (
attendance INTEGER,
venue VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the average attendance for all events held at Palmerston Park venue?
| SELECT AVG(attendance) FROM table_name_24 WHERE venue = "palmerston park" | sql_create_context |
CREATE TABLE table_77119 (
"Day 1" text,
"Day 2" text,
"Day 3" text,
"Day 4" text,
"Day 5" text,
"Wednesday" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the day 1 when the day 3 is math?
| SELECT "Day 1" FROM table_77119 WHERE "Day 3" = 'math' | wikisql |
CREATE TABLE time_zone (
time_zone_code text,
time_zone_name text,
hours_from_gmt int
)
CREATE TABLE airport_service (
city_code varchar,
airport_code varchar,
miles_distant int,
direction varchar,
minutes_distant int
)
CREATE TABLE flight_fare (
flight_id int,
fare_id int
)
C... | 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 = 'BURBANK' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER... | atis |
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 All_Neutral, All_Games_Percent FROM basketball_match ORDER BY All_Neutral DESC | nvbench |
CREATE TABLE table_69786 (
"Region" text,
"Date" text,
"Label" text,
"Format" text,
"Catalog" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the release date of a CD with the catalog number ALCA-9206?
| SELECT "Date" FROM table_69786 WHERE "Format" = 'cd' AND "Catalog" = 'alca-9206' | wikisql |
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 zyjzjlb.JZLSH FROM hz_info JOIN zyjzjlb ON hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX WHERE hz_info.RYBH = '27848867' AND NOT zyjzjlb.JZLSH IN (SELECT jybgb.JZLSH FROM jybgb WHERE jybgb.BGRQ <= '2004-10-16') | css |
CREATE TABLE table_74952 (
"Rank" text,
"Nation" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Nation has a Gold of 0, and a Bronze smaller than 6, and a Rank of 6?
| SELECT "Nation" FROM table_74952 WHERE "Gold" = '0' AND "Bronze" < '6' AND "Rank" = '6' | wikisql |
CREATE TABLE t_kc22 (
AMOUNT number,
CHA_ITEM_LEV number,
DATA_ID text,
DIRE_TYPE number,
DOSE_FORM text,
DOSE_UNIT text,
EACH_DOSAGE text,
EXP_OCC_DATE time,
FLX_MED_ORG_ID text,
FXBZ number,
HOSP_DOC_CD text,
HOSP_DOC_NM text,
MED_DIRE_CD text,
MED_DIRE_NM text,... | 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 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 DISTINCT medication.routeadmin FROM medication WHERE medication.drugname = 'fentanyl 2000 mcg in d5w 100 ml infusion final conc = 20 mcg/ml' | eicu |
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
CREATE TABLE locations (
LOCATION_ID decimal(4,0),
STREET_ADDRESS varchar(40),
POSTAL_CODE varchar(12),
CITY varchar(30),
STATE_PROVINCE varchar(25),
COUNTRY_ID varchar(2)
)
CREATE TABLE countries (
COUNTRY_ID... | SELECT HIRE_DATE, SUM(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY SUM(SALARY) DESC | nvbench |
CREATE TABLE table_14903081_1 (
began INTEGER,
country VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What year was the tournament first held in Italy?
| SELECT MIN(began) FROM table_14903081_1 WHERE country = "Italy" | sql_create_context |
CREATE TABLE chartevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE diagnoses_icd (
row_id numbe... | SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title =... | mimic_iii |
CREATE TABLE table_name_17 (
oricon INTEGER,
romaji_title VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Oricon has a Romaji title of nakitakunalu?
| SELECT MAX(oricon) FROM table_name_17 WHERE romaji_title = "nakitakunalu" | sql_create_context |
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... | SELECT (SELECT COUNT(*) FROM t_kc22 WHERE STA_DATE BETWEEN '2008-05-23' AND '2009-06-08' AND MED_INV_ITEM_TYPE = '手术费' GROUP BY MED_ORG_DEPT_CD ORDER BY COUNT(*) DESC LIMIT 1) - (SELECT COUNT(*) FROM t_kc22 WHERE STA_DATE BETWEEN '2008-05-23' AND '2009-06-08' AND MED_INV_ITEM_TYPE = '手术费' GROUP BY MED_ORG_DEPT_CD ORDER... | css |
CREATE TABLE table_31434 (
"Series #" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Viewers (million)" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many people wrote the episode directed by Arvin Bro... | SELECT COUNT("Written by") FROM table_31434 WHERE "Directed by" = 'Arvin Brown' | wikisql |
CREATE TABLE table_5585 (
"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 Pick # is the highest one that has a Name of lawrence sidbury, and a Round smalle... | SELECT MAX("Pick #") FROM table_5585 WHERE "Name" = 'lawrence sidbury' AND "Round" < '4' | wikisql |
CREATE TABLE table_name_28 (
away_team VARCHAR,
venue VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the away score at the Princes Park game?
| SELECT away_team AS score FROM table_name_28 WHERE venue = "princes park" | sql_create_context |
CREATE TABLE media_types (
id number,
name text
)
CREATE TABLE invoices (
id number,
customer_id number,
invoice_date time,
billing_address text,
billing_city text,
billing_state text,
billing_country text,
billing_postal_code text,
total number
)
CREATE TABLE employees (
... | SELECT name FROM media_types | spider |
CREATE TABLE table_62159 (
"Rank" text,
"Name" text,
"Height ft ( m )" text,
"Floors" real,
"Year" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the height of the the building ranked 13= with fewer than 28 floors?
| SELECT "Height ft ( m )" FROM table_62159 WHERE "Rank" = '13=' AND "Floors" < '28' | wikisql |
CREATE TABLE table_203_653 (
id number,
"rank" number,
"nation" text,
"gold" number,
"silver" number,
"bronze" number,
"total" number
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- which country is last on the table ?
| SELECT "nation" FROM table_203_653 ORDER BY id DESC LIMIT 1 | squall |
CREATE TABLE table_name_69 (
home VARCHAR,
away VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What home has 1-5 as the away?
| SELECT home FROM table_name_69 WHERE away = "1-5" | sql_create_context |
CREATE TABLE table_name_21 (
first_branch_opened VARCHAR,
branch VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the First Branch Opened, when Branch is Belmont Library?
| SELECT first_branch_opened FROM table_name_21 WHERE branch = "belmont library" | sql_create_context |
CREATE TABLE table_31473 (
"Rank" real,
"Rider" text,
"Sat 20 Aug" text,
"Mon 22 Aug" text,
"Tues 23 Aug" text,
"Wed 24 Aug" text,
"Thurs 25 Aug" text,
"Fri 26 Aug" text,
"Sat 27 Aug" text,
"Mon 29 Aug" text,
"Wed 31 Aug" text
)
-- Using valid SQLite, answer the following q... | SELECT "Tues 23 Aug" FROM table_31473 WHERE "Wed 24 Aug" = '22'' 23.29 101.116mph' | wikisql |
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
... | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-50213... | eicu |
CREATE TABLE table_name_29 (
week VARCHAR,
attendance VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What week were there 56,023 people in attendance?
| SELECT COUNT(week) FROM table_name_29 WHERE attendance = 56 OFFSET 023 | sql_create_context |
CREATE TABLE table_204_236 (
id number,
"title" text,
"release date" text,
"developer(s)" text,
"publisher(s)" text,
"genre(s)" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- number of gangster games released by developer rockstar north
| SELECT COUNT("title") FROM table_204_236 WHERE "developer(s)" = 'rockstar north' | squall |
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5)
)
CREATE TABLE EMPLOYEE (
EMP_NUM int,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
E... | SELECT CRS_CODE, COUNT(*) FROM CLASS GROUP BY CRS_CODE ORDER BY COUNT(*) | nvbench |
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE PostFeedback (
Id nu... | SELECT COUNT(*) AS AnsweredVolume, TIME_TO_STR(P.CreationDate, '%Y') AS "year", TIME_TO_STR(P.CreationDate, '%m') AS Month FROM Posts AS P WHERE (Tags LIKE '%<ios%' AND NOT Tags LIKE '%<iostream>%') AND PostTypeId = 1 AND CommunityOwnedDate IS NULL AND ClosedDate IS NULL AND AcceptedAnswerId > 0 GROUP BY TIME_TO_STR(P.... | sede |
CREATE TABLE table_name_23 (
time VARCHAR,
set_3 VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the time when the set 3 score is 31 29?
| SELECT time FROM table_name_23 WHERE set_3 = "31–29" | sql_create_context |
CREATE TABLE affected_region (
region_id number,
storm_id number,
number_city_affected number
)
CREATE TABLE region (
region_id number,
region_code text,
region_name text
)
CREATE TABLE storm (
storm_id number,
name text,
dates_active text,
max_speed number,
damage_millions... | SELECT region_name FROM region WHERE region_name <> 'Denmark' | spider |
CREATE TABLE table_61709 (
"Pos." text,
"Class" text,
"Entrant" text,
"Drivers" text,
"Laps" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What driver had 101 laps?
| SELECT "Drivers" FROM table_61709 WHERE "Laps" = '101' | wikisql |
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... | SELECT COUNT(Id) FROM Users | sede |
CREATE TABLE table_55691 (
"Driver" text,
"Constructor" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who is the constructor with the grid of 8?
| SELECT "Constructor" FROM table_55691 WHERE "Grid" = '8' | wikisql |
CREATE TABLE table_19705 (
"Prefix size" text,
"Network mask" text,
"Available subnets" real,
"Usable hosts per subnet" real,
"Total usable hosts" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When the network mask is 255.255.255.128 what is the lo... | SELECT MIN("Available subnets") FROM table_19705 WHERE "Network mask" = '255.255.255.128' | wikisql |
CREATE TABLE table_46651 (
"Draw" real,
"Song" text,
"Performer" text,
"Televotes" real,
"Rank" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- WHich Televotes has a Performer of biljana dodeva, and a Draw larger than 10?
| SELECT MIN("Televotes") FROM table_46651 WHERE "Performer" = 'biljana dodeva' AND "Draw" > '10' | wikisql |
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number... | SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t1.itemid FROM (SELECT labevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age >= 60) AND STRFTIME('%y', labevents.charttime) >=... | mimic_iii |
CREATE TABLE table_53055 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Decision" text,
"Attendance" real,
"Series" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was at home on april 14?
| SELECT "Home" FROM table_53055 WHERE "Date" = 'april 14' | wikisql |
CREATE TABLE technician (
technician_id real,
Name text,
Team text,
Starting_Year real,
Age int
)
CREATE TABLE repair_assignment (
technician_id int,
repair_ID int,
Machine_ID int
)
CREATE TABLE repair (
repair_ID int,
name text,
Launch_Date text,
Notes text
)
CREATE T... | SELECT Name, COUNT(Name) FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.Machine_ID = T2.Machine_ID JOIN technician AS T3 ON T1.technician_id = T3.technician_id WHERE T2.value_points > 70 GROUP BY Name ORDER BY Name DESC | nvbench |
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name text
)
CREATE TABLE cost (
row_id number,
subject_id number,
hadm_id number,
event_type text,
event_id number,
chargetime time,
cost numb... | SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'periph nerve transposit') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 2489) AND D... | mimic_iii |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "55" AND lab.itemid = "51026" | mimicsql_data |
CREATE TABLE table_38234 (
"Nation" text,
"T Score" real,
"A Score" real,
"E Score" real,
"Total" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the total number of A scores for Japan when the T score was more than 4?
| SELECT COUNT("A Score") FROM table_38234 WHERE "Nation" = 'japan' AND "T Score" > '4' | wikisql |
CREATE TABLE table_name_6 (
team VARCHAR,
long VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which team has a long of 67?
| SELECT team FROM table_name_6 WHERE long = "67" | sql_create_context |
CREATE TABLE table_42122 (
"City" text,
"State" text,
"AAM Accredited" text,
"AAM Member" text,
"ASTC Member" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is City, when ASTC Member is No, when State is California, and when AAM Member is Yes?
| SELECT "City" FROM table_42122 WHERE "ASTC Member" = 'no' AND "State" = 'california' AND "AAM Member" = 'yes' | wikisql |
CREATE TABLE table_1341843_15 (
incumbent VARCHAR,
district VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who's the incumbent of Indiana 4 district?
| SELECT incumbent FROM table_1341843_15 WHERE district = "Indiana 4" | sql_create_context |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.